PHP installation with extensions (mysql) for IIS7 in Windows Vista
When you download the PHP installer, it fails to install for Windows Vista. So you have to install it manually. Just download the zip file and extract it somewhere that you can remember. Then you might want to manual installation instructions, but it won’t be correct for IIS7. Here is the guideline to install PHP to IIS7.
- Copy the php.ini to windows folder. enable the needed extensions by editing the file. Give rights for the file, to IUSR user, so that IIS can access the file.
- Run IIS Manager (inetmgr.exe)
- For the main site, click to ISAPI Filters, right click to add or actions add to php ISAPI handler with the filter name that you want. Just point to php5isapi.dll file which is the isapi filter.
- Than come back to main site, and click to ISAPI and CGI Restrictions, and click add a restriction. For ISAPI and Cgi path select php5isapi.dll file and give a desired name for description. Also don’t forget to click “Allow extension path to execute”
- Make sure that after adding, php is allowed from the ISAPI and CGI Restrictions window.
- On ISAPI and CGI Restrictions page, right click to php and click to “Edit feature Settings”, from there you need to select both of them to enable php extensions to work, like mysql, mssql or ssl extensions specified in my.ini
- Go to main site again, and click for the “Handler Mappings”. Click to add “Script Map”. For the request path type *.php, executable is php5isapi.dll Name is Php
- It will ask for the script map to add, just click to yes.
- Our php and extensions should work now, but we might want to add index.php file to look for a folder. From the main window, we click to “Default Document” and add index.php to the end of list.
That’s all for php and extensions to work.



I followed your instructions and I got the error message:
Server Error in Application “Default Web Site”
HTTP Error 500.0 - Internal Server Error
Description: Calling LoadLibraryEx on ISAPI filter “C:\Inetpub\php\php5isapi.dll” failed
Error Code: 0×800700c1
Notification: Unknown
Module: IIS Web Core
Requested URL: http://localhost:80/brie/brie_index.php
Physical Path: C:\inetpub\wwwroot\brie\brie_index.php
Logon User: Not yet determined
Logon Method: Not yet determined
Handler: StaticFile
Any ideas?
Mike
30 September 2006, 12:22 amThat might be the cause of the security features of Windows Vista. I just disabled them and make it look like Windows XP.
30 September 2006, 8:00 pmCould you please try to give rights to anonymous or everyone Users, as far as IIS7 is OK with that for php folder (C:\inetpub\php in your case)
I’ve tried that already to no avail. I have also tried reinstalling php but still no luck. I am using php5.1.6 obtained from php.net.
1 October 2006, 11:10 pmActually installation of php won’t work. You need to get the zip file and somehow follow the php instructions combined by the instructions above.
1 October 2006, 11:20 pmI have followed the tutorial, except for one point. “Give rights for the file, to IUSR user, so that IIS can access the file.” I do not understand how to do this.
I will try to launch phpMyAdmin and it will say: “cannot load mysql extension; please check PHP configuration”. I have MySQL installed and the extensions enabled in the php.ini in the windows directory. Any ideas?
4 October 2006, 9:57 amI received the same problem as Mike
8 October 2006, 5:44 pmThank you! I got my mysql extension working finally.
16 October 2006, 7:31 pmcould you please tell me how to enable mysql extensions?
here is my php extensions directory:
extension_dir = c:\php\extensions
and here is the enabled list:
extension=php_curl.dll
extension=php_gd2.dll
extension=php_ming.dll
extension=php_mssql.dll
extension=php_mysql.dll
note that the other extensions is works! such as curl and gd…… but I didn’t see mysql list in phpInfo()
can you please help me…..??
16 November 2006, 12:50 pm10x man .. U saved me .. it really matters the order u make the speps.. other tutorials didn`t work .. until I found u! 10x
using Vista Ultimate x64
15 December 2006, 1:47 amcopy c:\php\dlls\*.dll c:\windows\system32 under administrator console should solve problem (admin console is invoked by start->accesories right click at “command prompt” and “Run as administrator”)
17 January 2007, 11:32 amAlso you will need probably another version of - ntwdblib.dll Version: 2000.80.194.0. Download from http://webzila.com/?wz=dll and search for it.
17 January 2007, 11:58 am[...] versions. If for any reason something goes wrong and you can’t get things to work check out Can Erten’s post which has some further steps including permission changes and ISAPI and CGI [...]
1 February 2007, 1:32 pmIf you’re still having issues with the mysql extension mysteriously not loading, try running PHP from the command-line When I did this, I had an alert display explaining that it could not find/load ‘MSVCR71.DLL’, and in the command-window a message saying it was “unable to load dynamic library ‘c:\inetpub\PHP\ext\php_mysql.dll’ - The specified module could not be found.”
Ah ha! Searched around and sure enough that DLL was no where to be found on my system. I searched for it using the link that boogie provided, dropped it in my PHP folder and it worked. I had to restart the web-service to re-init the PHP isapi layer, but after so so so many hours of frustration, it worked … IT WORKED!
20 February 2007, 3:09 amThanks! Very userful.
23 February 2007, 2:02 amI was looking for something like this.
i have succeded in instaling php on vista/IIS7, but the modules like mysql, openssl etc are not working, i have enabled them in php.ini, which is in windows folder, rights for this file are set to IIS_IUSRS, path to modules is correct
but info(); says nothing about modules at all and they are not working, i dont know where to look for a mistake anymore
23 February 2007, 10:44 pmfinally solved .. restart of app pool helped me
23 February 2007, 10:48 pmi have aslo added to php.ini ACL network service account
23 February 2007, 10:49 pmThanks . A great article . It helps me a lot.
5 March 2007, 7:04 pmi am having problem.!!!!!!. looked everywhere but i couldn’t find any solution… if any of you can help me pls. help.. i’ve installed php with iis7. the works but everything else doesn’t. any ideas? thanx
7 March 2007, 4:22 ami am having problem.. looked everywhere but i couldn’t find any solution… if any of you can help me pls. help.. i’ve installed php on iis7. the “php phpinfo(); ”
7 March 2007, 4:25 amworks but everything else doesn’t. i get 500 error.. any ideas? thanx
I did all the points as it was wrote and php still doesn’t work on iis 7.
7 April 2007, 6:23 pmTo get the extensions working I had to edit the php.ini extension_dir and set it to the path of the ext dir eg. “C:\Program Files\php-5.2.1\ext”
17 April 2007, 12:30 amThen i had to include the php path in the system environment path. You can find this in the properties of “My Computer” - Advanced System Settings.
A good old reboot saw my phpinfo() page reporting my extensions all loaded.
Thanks, man!
1 May 2007, 5:35 pmI found my solution here: http://bugs.php.net/bug.php?id=39163
For those of us getting the ‘Calling LoadLibraryEx on ISAPI filter “C:\PHP\php5isapi.dll” failed’ error after an attempted manual install:
1) *Start with a fresh IIS installation with both ISAPI filters and extensions enabled.
2) Under the main settings [at the very top of your IIS Manager's hierarchy view, above Application Pools], add the following in this order:
2.1) an ISAPI Filter for php5isapi.dll
2.2) a ISAPI and CGI Restriction entry for php5isapi.dll
2.3) a Handler Mapping for php5isapi.dll
3) Go to the application Pools section.
4) Right-click on Default Application Pool and select Advanced Settings.
5) Set the second option [Enable 32-Bit...] to True.
Now everything should work…
* Also, it is important that your ‘Default Website’ not have any unique settings from the top-level configurations. This was causing my ISS to exhibit some pretty strange behavior, which is why I recommend that you first delete your default website and create a new one.
9 May 2007, 5:07 pmThanks a lot.
Finally my php is working with IIs7.
Thanks again, I had several problems, all my problems were came from confusing between global setting and local setting.
As a begginer of IIS I havne’t realised that IIS7 has different setting option for global and local websites.
After I flush away all setting and follow setting…it works.
Don’t confused setting for global and local dude~~
15 May 2007, 8:09 pmDear,
19 May 2007, 5:08 pmI tried all the way that available on Internet to install PHP and connect MySQL to it but it gives me this error when I tried to run and test the MySQL:
Fatal error: Call to undefined function mysql_connect() in C:\inetpub\wwwroot\mysqltest.php
Can anybody help me!!
Thanks.
Hi,
Thanks so much for this. If it helps anyone, if you are having problems, REVERT EVERYTHING AND RE-INSTALL AND CONFIGURE in the correct order. That is:
1) remove all PHP
2) remove completely your IIS webserver (from Windows features).
Then,
1) re-install the webserver, ensure it loads up .html pages
2) install PHP
3) configure your webserver for PHP as described in this article.
Note: With newest IIS7, you do NOT need to explicitly manage the ISAPI restriction. In fact, you shouldn’t. Adding a script map will prompt you for this setting. So the one part in this article, #4: “come back to main site, and click to ISAPI and CGI Restrictions…”, NO LONGER APPLIES. For me, even the icon for those restrictions went away. The process is
a) add the ISAPI filter
b) add the script map
Hope this helps. I was frustrated for hours before finally doing the clean re-install of everything. Good article tho; thank you.
25 May 2007, 1:46 pmit works quite well.. except for one tiny but annoying thingy…
since i’m only using IIS at home for developing stuf, the traffic on the server is like zero.. only me gets on it
however, this results in that annoying message every time after 10 minutes or so… “IIS pocess worker has stopped working” .. well, duh!
so.. how to get rid of that annoying message.. :-)))
28 May 2007, 12:57 amI tried for so many ways to get PHP working on IIS7.
The steps on this post are in the right order, it works!. Thanks for your help!
Note: I had to uninstall IIS and PHP and I installed again, that solved the problem of extensions and some others.
24 January 2008, 5:25 pmworked fine many thx
24 January 2008, 10:16 pmDoesn’t work… u should test ur tuto under vista 64 bits before posting this…
28 January 2008, 3:45 pm
Well, I don’t have vista 64 but feel free to provide your own tutorial…
28 January 2008, 4:00 pmA reboot of the machine is required - not just the IIS web service. I’m using IIS 6.0 on W2K3 server, but it took me a few days of trying all sorts of things and searching the web far-and-wide before I just rebooted the server. Then the mysqli extension finally loaded. It bears repeating since most guides and instructions fail to mention it - REBOOT WINDOWS.
16 February 2008, 5:27 pmThanks FreakTrap for the bug fix to get it to work on x64! Life saver!
23 March 2008, 3:02 amThanx! I’ve done it!
19 April 2008, 10:45 amHi…
I´m From Brasil… and my Inglish is very bad… but i try…
THIS IS A VERY GOOD SOLUTION… WORK REALY OK…
BUT… REMEMBER… REBOOT YOUR MACHINE !!!
Thanks all
Grego.
21 July 2008, 11:54 pmSweet! This worked like a charm! Thanks for posting!!
27 July 2008, 9:32 pm