Hi, I'm a total newb.

I'm wanting to test out a PHP program so I installed apache on my Win7 machine along with PHP. I actually used the wamp install that installs the above along with MySql and some other goodies.

Anyway, it all seemed to install fine but when I go to call any of the .php pages it opens up and shows me the text that makes up the script rather than executing the script. Basically I type: http://localhost/filename.php and substitute the filename with whatever it should be and the browser just displays the contents of the file instead of running it.

html files display properly but not .php files.

I hope I'm posting this in the right place....Any ideas what I did wrong? Thanks!

Either:
1 - PHP isn't installed correctly:
create a script like this, save it as info.php or something and test it in the same way you have been doing

<?php
   phpinfo();
?>

2 - You haven't placed <?php ?> tags around your script.
3 - Could be some other content-type problem with apache

Post your code if you're still having problems

Hi,

Are you using PHP Short Tags (e.g. <? ...code... ?>)? If you are, this may be your problem. Just change '<?' to '<?php' and your problem should be solved.

Doesn't Work? If it doesn't work then I have no idea of what the problem is.

Hope this helps
Kieran :)

Thanks guys. I tried typing in the code that nonshatter suggested and it does the same thing. I've tried it with both short and long tags. If I open a command window and type "php info.php" then it executes and returns a big list of config info. But if I go into my browser and type "http://locahost/info.php" it just lists the code in the browser window without executing. I appreciate your taking the time to help. I'm new and I'm stumped! :)

John

Well, I reinstalled the wampserver and it works fine now. So I'm not sure what I did wrong before but this thing is solved. Thanks.

Well, I reinstalled the wampserver and it works fine now. So I'm not sure what I did wrong before but this thing is solved. Thanks.

haha, congrats dude. !! please notice if your php Short Tag is disabled you should use full open PHP tag. <?php ?> instead <? ?>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.