I installed Apache successfully on a Windows 7, 32bit system. It showed "It works" in the webpage. I also configured <?php phpinfo(); ?>file as info.php. But when I tried to open http://localhost/info.php in the browser, all I get is <?php phpinfo(); ?>in plain text.

I restarted Apache server every time I made changes. Anyone can help with this?

4 Answers 4


Add the appropriate handlers, as you could've read in the manual:

You need to insert the following lines into your Apache httpd.conf configuration file to load the PHP module for Apache 2.x:

LoadModule php5_module "c:/php/php5apache2.dll"
AddHandler application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"
  • I did exactly the same thing as you said, the result I got was as above, the plain text instead of php info. I'm using Apache 2.2 and php 5.3.8
    – manxing
    Commented Nov 11, 2011 at 14:12
  • you haven't PHP really, if you see php-page source as plain-text. Check all three strings above in httpd.conf (with your path) Commented Nov 12, 2011 at 14:43
  • For Apache 2.2 you have to use php5apache2_2.dll (php5apache2.dll doesn't exist on distro). For Apache-integration you must install php-5.3.8-Win32-VC9-x86 PHP distro Commented Nov 12, 2011 at 14:50

You have to configure PHP with Apache for it to work with php code. The easier course of action is to use something like http://www.wampserver.com/en/ . It will nicely and easily set things up for you, however at some point in time you will def need to dive into httpd.conf file and figure out how to manually setup PHP into Apache.


Are you sure your php5apache2.dll is actually in that path? It seems like a few years ago, I had to copy those from another directory in the PHP installation directory (though I don't remember what version of PHP I was working with at the time).

Aside: I would've posted this as a comment, but I don't have the rep yet.


Per this tutorial (step 4) try editing the doc_root line to point to the root folder of where you are serving PHP files from, e.g. doc_root = "C:\public_html". It should match the DocumentRoot path in your Apache config file.

Also, when you make changes to your Apache or PHP configs, you need to restart Apache for the changes to be loaded.

The tutorial I linked above has been my years-long guide for setting up and running the AMP stack on Windows, it's worth a look. Not the author, just a happy user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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