0

I am trying to learn basics of php.So I tried following example as in http://www.w3schools.com/

<!DOCTYPE html>
<html>
<body>
<h1>A Header</h1>
<?php
echo "My first PHP script!";
?>
</body>
</html>

This code was working two days ago. But now PHP part doesn't work.I have read this thread,but It is not that problem. Please help. Thank you.

Community
  • 1
  • 1
MDEVLP
  • 124
  • 1
  • 3
  • 12
  • 1
    are you running it via a web server with PHP enabled? – Spudley Aug 05 '13 at 15:02
  • 3
    What does "PHP part doesn't work" mean? Do you see the PHP tags in the HTML source or nothing at all? – JJJ Aug 05 '13 at 15:02
  • 3
    also, I suggest using a better resource to learn PHP than w3schools; there are many places on the web that will give you better advice. – Spudley Aug 05 '13 at 15:02
  • I am simply running it on browser from local hard drive. – MDEVLP Aug 05 '13 at 15:03
  • 2
    Yeah, that's not going to work. You need a web server. – JJJ Aug 05 '13 at 15:03
  • 1
    you need to install xampp or wamp or lamp in your machine... – VIVEK-MDU Aug 05 '13 at 15:05
  • You can't run a server side language (php) without a server to interpret the server side commands. In bare basic terms, the browser only reads out the text sent to it from the server. – scrappedcola Aug 05 '13 at 15:05
  • 1
    There are too many possible causes for this. Please **add details to narrow the answer set or to isolate an issue** that can be answered in a few paragraphs. – Jeff Noel Aug 05 '13 at 15:05
  • Possibly your wamp server has not completely started is the icon in green colour for wamp server –  Aug 05 '13 at 15:15

2 Answers2

2

Make sure that your web-server can execute php-scripts. Go through this: http://php.net/manual/en/install.php

Alma Do
  • 37,009
  • 9
  • 76
  • 105
1

I recommend you start learning PHP using this website http://www.developphp.com/list_php.php#Getting_Started_with_PHP_Programming it has everything you need to get you started, tutorials are nice and easy to follow :)

Check the Installation section and then maybe have a look at this one http://www.developphp.com/view_lesson.php?v=194 to solve your problem.

Hope it helps!- Good Luck!

Scur4
  • 154
  • 1
  • 13