1

I am trying to get started with PHP by creating a HelloWorld application, but when I try to run it, the PHP part of the code is not working.

Where it should have a header saying Hello World! It says Hello World'; ?> in regular text instead.

Any idea what I'm doing wrong?

Here is my code:

<html>
 <head>
  <meta charset="UTF-8">
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo '<h1>Hello World</h1>'; ?> 
 </body>
</html>

I am running it using a local php server and it seems to be serving fine.

php -S localhost:8888
PHP 5.5.20 Development Server started at Tue Dec  8 14:12:26 2015
Listening on http://localhost:8888

Also, when I create a <?php phpinfo ?> saved as a php file, it works and gives all the data.

I already made sure to save it as a UTF-8-encoded file.


  • "how" are you accessing that file? as `http://localhost/file.php` or as `c:///file.php`? 2 different animals here. – Funk Forty Niner Dec 08 '15 at 19:43
  • php isn't executing. do a view source on the page and you'll see the raw php code. raw php code is treated as invalid html by your browser, and the ` – Marc B Dec 08 '15 at 19:43
  • i think the browser makers should start helping and when they encounter ` –  Dec 08 '15 at 19:45
  • @Dagon we have the technology, the money and the personnel to do it. Just no "time". – Funk Forty Niner Dec 08 '15 at 19:50
  • Ahhh I am new to this and still stupid. I had saved it as a .html, not a .php. Thanks for the help, everyone. Sorry for the duplicate, Dagon. I swear I did look for like 20 minutes. – JasonOdysseus Dec 08 '15 at 20:39

0 Answers0