Install PHP For Windows IIS


Download & Unpack
Download and install PHP from, you should grab
the newest 5.x.x Windows Binaries zip package that will work on apache.

My file was named:
Unzip php. In my case, I unzipped to:
Rename C:\php\php.ini-dist it to php.ini
Edit your php.ini
Open php.ini in a text editor and scroll down about halfway through the file and
look for doc_root then change it to point to whatever your Apache DocumentRoot
is set to. In my case: doc_root = “C:\public_html”

Scroll down about 7 more lines and change the extension_dir from extension_dir =
“./” to the location of the ext directory after you unzipped PHP. in my case:
extension_dir = “C:\php\ext”

If you are going to be using your server for testing, i recommend (this is
optional) you search and change the error reporting to give you info on any
errors, notices, or bad coding. If you want to enable this type of stuff, search
for error_reporting for and change:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
error_reporting = E_ALL | E_NOTICE | E_STRICT

Editing Apache Conf File
Using Notepad open httpd.conf (should be start-menu shortcut “Apache HTTP Server
2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File”).
Either at the very beginning or end of the file add the following lines: (NOTE:
be sure to change BOTH C:/php parts to the directory you installed your php to)
LoadModule php5_module “C:/php/php5apache2_2.dll”
AddType application/x-httpd-php .php
PHPIniDir “C:/php”

Note: If you installed the older Apache 2.0, instead of the above lines, you
will need to use the lines listed on the bottom step of the Apache 2.0 tutorial.
[OPTIONAL] Editing Apache Conf File (part 2)
To get apache to automatically look for an index.php, search httpd.conf for
DirectoryIndex (about line 212) and add the files you want apache to look for
when a directory is loaded (if it doesn’t find any of these files, it displays
folder contents). Mine looks like:

DirectoryIndex index.php index.html default.html

Restart Apache if it is already running (if it doesn’t start or you get errors,
use your Apache “Test Configuration” shortcut in the Start Menu to see why).

To test your PHP simply create a test.php file in your Apache “DocumentRoot”
folder (E:\public_html\ in my case). In your test.php file, type these 3 lines
and then load the file in your browser like http://localhost/test.php (you
should get a whole long list of php variables, settings, etc):

Documentation Suggestion
One weird thing I have noticed about PHP is that it does not come with
documentation of any kind. If you are a php developer/programmer, I suggest you
download the documentation. Downloads can be found on and I personally recommend the “English –
Windows HTML Help” (chm) version as the search is so handy, although they all
contain the same information.



Please enter your comment!
Please enter your name here