PHP not working at all
Posted by: gnylakai (---.dhcp.hckr.nc.charter.com)
Date: March 14, 2008 07:23AM

I'm a bit of a newb to php, but still a good coder and can't seem to find out what is up with php on wampserver2. I have two similar code examples that should both output the same thing, yet neither of them work properly. I downloaded wampserver2 and installed it properly, but I still don't understand what is wrong. Here are the examples and their output:

Example 1:

<HTML>

<HEAD>

<TITLE>My First PHP Page</TITLE>

</HEAD>

<BODY>

<?php

echo "<p>Hello World!</p>";

?>

</BODY>

</HTML>



**********OUTPUT***********

Hello World!

"; ?>

******************************


---------------------------------------------
Example2:


<HTML>

<HEAD>

<TITLE>My First PHP Page</TITLE>

</HEAD>

<BODY>

<?php

echo "Hello World!";

?>

</BODY>

</HTML>




**********OUTPUT***********




******************************
_________________________________________________

Thats right... nothing. I am pretty positive that this is the standard convention for the php "Hello World" 'program' and I still can't seem to get it right. I'm not sure if there is a minor flaw, or if php is not installed correctly on my computer. Everything in WampServer is running and online, and my files are located in the C/Wamp/www directory.

Any help would be greatly appreciated.

Options: ReplyQuote
Re: PHP not working at all
Posted by: toivo (---.nsw.bigpond.net.au)
Date: March 14, 2008 09:18AM

Hi,

Even though your examples are minimal in terms of HTML, both of them produce the greeting all right when run in a working server. Did you change any of the default settings?

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: PHP not working at all
Posted by: gnylakai (---.dhcp.hckr.nc.charter.com)
Date: March 15, 2008 05:47AM

My server is running correctly, as best to my knowledge. I'm running Apache 2.2.8, and when I type localhost in my firefox browser, the wampserver page comes up with the Server Configuration page.

I have not messed with any of the settings of any of the wampserver files, or the apache files. I have installed it on this computer before and everything worked fine, but due to a recent system restore I installed it again and I'm getting the incorrect output.

I'm just trying to run a basic dynamic html/php page with only an echo command, and I'm getting the wrong results. Any other tips or steps I can take to diagnosing the problem?

Thanks,

Rob
U.S.A., North Carolina

Options: ReplyQuote
Re: PHP not working at all
Posted by: toivo (---.nsw.bigpond.net.au)
Date: March 15, 2008 08:50AM

Try this:

<?php
phpinfo();
?>

You should see the PHP configuration, nicely formatted in an HTML table.

Do you how the system was restored? Was it restored from an image of a working system? You may have to go back to the basics or to a clean install of the operation system to get to a known state and then re-install WAMP.

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: PHP not working at all
Posted by: yfastud (Moderator)
Date: March 15, 2008 05:00PM

Did you save them as php files? Make sure to disable "Hide known extension..." so you can see the real extension of your files

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: PHP not working at all
Posted by: geminii71nc2 (---.client.mchsi.com)
Date: March 16, 2008 08:40PM

I get the same thing when I try that! I am new to this to and am using the book php6. Are you using this book too? I show the same code at the end of th e greeting! i HAVE NOT CHANGED ANY SETTINGS ON MY COMPUTER EITHER. iF YOU FIND A SOLUTION PLEASE LET ME KNOW!!!

Options: ReplyQuote
Re: PHP not working at all
Posted by: hambuler (---.cpe.net.cable.rogers.com)
Date: March 16, 2008 10:45PM

Try to run the file without php tags. HTML tags only in php file. Let's see if the output is fine.

Options: ReplyQuote


Sorry, only registered users may post in this forum.