Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to install and test a development server on my Windows 7 laptop following this tutorial.

However when I ran the script on the browser as:

http://localhost/info.php

I only got:

PHP source

Does anyone have any pointers for fixing this?

share|improve this question

closed as not a real question by random Jul 28 '11 at 13:35

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Could you add the error log from C:\Program Files\Apache Software Foundation\Apache2.2\logs\error.log? Have you restarted Apache after enabling PHP? –  Lekensteyn Jul 5 '11 at 17:59
    
yes, I did restart apache. –  zman Jul 5 '11 at 18:54
    
Could you attach your error.log file? –  Lekensteyn Jul 5 '11 at 18:57
1  
Give "apache is not interpreting .PHP files" a read on Server Fault. You could also try using an automated WAMP package like XAMPP. –  nhinkle Jul 7 '11 at 15:13
add comment

2 Answers

You basically need to tell Apache to, instead of sending the text of .php files to the client directly, to instead send them to a script interpreter.

So it sounds like things messed up where you had to add your PHP interpreter as a handler. Did you perform step 5 of your tutorial correctly? Also, if I'm not mistaken, newer versions of Apache don't use httpd.conf for any configuration information but the base configuration file is apache2.conf or something like that.

share|improve this answer
    
on the tutorial, the last line for modifying the php handler is PHPIniDir "C:/windows", and for the link you provided, I found: PHPIniDir "C:/php". Which one is correct? –  zman Jul 5 '11 at 18:51
    
I'd search your system for php.ini and, wherever it is, use that path. –  ultrasawblade Jul 5 '11 at 19:04
add comment

PHP is probably not installed correctly or you haven't installed apache with php support. Are you building all this from source?

What's happening?

Right now you have a php file which, when navigated to, doesn't display results. Instead it displays it's code just like if it was a simple text file. This is cause by PHP not being able to parse the file and interpret it as code. Therefore your browser sees it as text and displays it as such. The comment below (by horatio) outlines what specifically needs to be present for PHP and Apache to work nicely together. Installing PHP isn't the only thing needed, you need to modify apache's config file to tell it how to handle .php files.

share|improve this answer
    
Hi Max, I think apache is ok, and I installed it using the MSI, windows installer package. –  zman Jul 5 '11 at 18:09
    
There are two places to check for PHP installation: 1) apache http.config must be set to load the PHP module. (restart the apache service after enabling) and 2) since you are using a local machine, you can test running the php script via the command line by invoking php. –  horatio Jul 5 '11 at 18:21
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.