Page 1 of 1

php not working as example in the book

Posted: Fri May 15, 2009 11:02 am
by phptime
Per the example in the book this should say "Hello World"on my screen with the window being titled "PHP says hello"

For some reason the window is titled correctly but the php print of "Hello World" never shows. I have confirmed my php installation. The part that really gets me is this is like example 1. I guess its going to be a long road for me. Anyone have any ideas on why this is not working for me?

Code: Select all

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

Re: php not working as example in the book

Posted: Fri May 15, 2009 11:06 am
by Benjamin
Your PHP isn't being parsed. Place the following in an empty file and view it in your browser. You should see detailed installation information.

Code: Select all

<?php phpinfo(); ?>
What URL are you using to view the example you created?

Re: php not working as example in the book

Posted: Fri May 15, 2009 11:31 am
by phptime
I think part of the problem is I have tried multiple installs. I have also used MAMP and now I have no clue on where my localhost is.

when i type in localhost I get the page you were referring too.

Is there any way to just start fresh without wiping the drive? using OS X.5 FYI.

Any help is appreciated!

Re: php not working as example in the book

Posted: Fri May 15, 2009 11:36 am
by phptime
This problem has been solved. Thank you for your help. The solution?

Well I will only post it since it may help someone else (even though it shows what a complete idiot I really am). The solution was to make sure the file ended with a .php vs .html. Yep I am that dense. Thanks for the quick help as it actually helped lead me to my solution!