Following up on my last post, I’ve now got a working IIS 7 web server running on Windows 2008. We’re now going to install PHP5 and MySQL 5.1.
Installing PHP5 on IIS 7
First of all, grab yourself a copy of PHP over at http://www.php.net/downloads.php. I always use the zip package, I never use the installer. The installer only installs and configures the CGI version of PHP which is not the best solution for an IIS web server. I prefer using the ISAPI version.
At the time of this writing, the latest PHP version is 5.2.5.
- Download the latest PHP version for Windows and unzip its content in a temporary folder on your hard disk.
- When you’re done, create a folder named php at the root of your hard drive (e.g.: c:\php).
- Move all the content from the extracted archive to c:\php

- Rename the file c:\php\php.ini-recommended to c:\php\php.ini and open it with your favorite text editor (no word processor).
- Find the extension_dir parameter and set its value to “c:\php\ext”. Save the file and exit the editor.
- Launch the registry editor: Start => Run => regedit
- Create a new key named PHP under HKEY_LOCAL_MACHINE\SOFTWARE\
- Right-click on the newly created key and select New => String Value
- Name the new value IniFilePath and set the value data to C:\php
- Click on Start => Settings => Control Panel and double-click the System icon (using the class view).
- Click on the Advanced system settings link from the left column.
- From the System Properties window, click on the Advanced tab and then on the Environment Variables button at the bottom.
- Select the Path variable from the System Variables section and click on Edit. Add c:\php to your system path (be sure to include the semi-colon separator).

- Click on OK until you’ve exited the System Properties window .
- Launch the Internet Information Services Manager: Start => Programs => Administrative Tools => Internet Information Services (IIS) Manager
- From the IIS Manager, click on your server’s hostname from the Connections panel on the left. Double-click on Handler Mappings icon.

- From the Handler Mappings actions panel, click on Add Script Map…

- Fill-in the information as illustrated below and hit OK:

- Click again on your server’s hostname from the left panel and double-click on the ISAPI And CGI Restrictions icon.
- From the Actions panel on the right click on Add…
- Enter the information to allow PHP processing as illustrated below and hit OK:

- Click on your server’s hostname form the left panel and double-click on the Default Document icon.
- Click on Add… from the actions panel on the right.
- Enter index.php in the new default document name and click on OK.
- Click on your server’s hostname from the left panel and then click on Restart from the actions panel on the right.
- Create a new text document and save it to c:\inetput\wwwroot\phpinfo.php with the following content:<?php phpinfo(); ?>
If everything is ok, you should now see the PHP information page at http://your-server-name/phpinfo.php:

Stay tuned for my next post on how to install MySQL 5.1 on Windows 2008.
9 responses so far ↓
1. Response by : Bill Staples on Feb 12, 2008 at 5:44 pm
Be sure and also check out the new fastCGI feature available for IIS 6 and IIS 7. It allows PHP to run much more reliably on IIS, with great performance. I recommend it over the Isapi based PHP referred to above. See http://iis.net/php for more information.
2. Response by : Stephane Brault on Feb 13, 2008 at 9:04 am
Hi Bill,
Thank you for pointing that out. I’ll look further into fastCGI and make it a future post.
Thanks!
3. Response by : grncobra on Feb 25, 2008 at 6:31 am
the tutorial was good, but i noticed that we were editing the php configuration file “c:\php\php.ini” but the output of the script “phpinfo.php” indicated that the configuration did not load(configuration file loaded = none) and its path was “C:\Windows”(configuration file path = c:\windows), when it was suppose to be “c:\php”, the one we previously edited.
4. Response by : Stephane Brault on Feb 25, 2008 at 7:36 am
Steps 6 to 9 are where you create a registry key that sets the path for php.ini
Still you should have a look at how to install PHP with FastCGI instead: http://www.thewebhostinghero.com/tutorials/windows2008-iis7-fastcgi-php.html
5. Response by : Ahmed on Feb 26, 2008 at 11:24 pm
this what I got after following your instructions:
HTTP Error 404.0 - Not Found
Description: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Error Code: 0×8007007e
Notification: ExecuteRequestHandler
Module: IsapiModule
Requested URL: http://localhost:80/phpinfo.php
Physical Path: C:\inetpub\wwwroot\phpinfo.php
Logon User: Anonymous
Logon Method: Anonymous
Handler: PHP-ISAPI
Most likely causes:
The directory or file specified does not exist on the Web server.
The URL contains a typographical error.
A custom filter or module, such as URLScan, restricts access to the file.
can anyone tell me what am I doing wrong here please?
thanks
6. Response by : Ahmed on Feb 27, 2008 at 6:28 am
ok.. I deleted all the files of php and deleted everything I did for installing it.. and started everything again.. everything went fine.. but this time, when I finished everything and when I opened as said in this tutor.. the error has disappeared but the problem is that nothing showed up in the page.. only white blank page.. after that I found in some webs someone who says to write this html code in the phpinfo.php file instead of the one you said in here
here is the code
PHP Information
the question is: did I do something wrong or everything is ok?
and why didn’t anything showed in the page when I put the first code but when I put the html code everything showed up as it supposed to be?
I’m just a newbie in php and I hope you can help me..
thanks
7. Response by : Stephane Brault on Feb 27, 2008 at 6:59 am
Hi Ahmed,
Try installing PHP with FastCGI instead:
http://www.thewebhostinghero.com/tutorials/windows2008-iis7-fastcgi-php.html
8. Response by : mike on Mar 14, 2008 at 2:26 am
Followed this to the T, however it didn’t work. Replaced all reference to the isapi with the fastcgi and everything worked well.
Now I only hope that mysql will co-operate with server 2008 and wordpress, as it hasn’t in the past with me.
9. Response by : mike on Mar 14, 2008 at 10:14 pm
Update: What an excellent finish! After using fastcgi instead of isapi module and using very specific builds of all 3, I was able to get WordPress working! Point yourself over to http://blackboxdisease.wordpress.com/2008/03/15/wordpress-on-server-2008/ for the specific builds if you plan on running WordPress on Windows Server 2008
Leave a Comment