Php doesn't display content in browser

Hi,

I’m new to PHP and since I’m setting up a website using Joomla 2.5, I need some basic understanding of PHP. But when I run the following code, from a book I’m using as a intro text, nothing is displayed on Firefox (version 18).


<html>
<head><title>PHP says hello</title></head>
<body>
<b>
<?php
echo "Hello, World!";
?>
</b>
</body>
</html>

I’ve checked out phpinfo() to the extent of my limited understanding and I can’t see anything obviously wrong.

Any help would be much appreciated

I didn’t mention that I saved the file as html. I changed this to php but no text shown on opening the file in Firefox.

Make the file a .php file, and add the 2 ‘php’ lines …


<?php
?>
<html>
<head><title>PHP says hello</title></head>
<body>
<b>
<?php
echo "Hello, World!";
?>
</b>
</body>
</html>

I ran this through php, and it seemed to output what you need (html code).

Hi Jesoshua,

I had some success too. I moved the original file over to /var/www directory (localhost) and it ran OK as a php file. I also made the changes you suggested and that worked too. My mistake really was rather obvious when you come to think of it, php obviously works within the server environment.

Thanks for your help, I appreciate it.

Hi Jehoshua,

sorry I mispelt your name

best regards

Royt