Quick tips for installing PHP + IIS7 under Windows 7


If you are trying to install PHP under the default configuration of IIS7 with Windows 7 (and presumably Vista & Server 2008, but I observed it under Win7), you might run into problems (for example getting “Service Unavailable” errors). Here is how I managed to fix them:

First, make sure that you’ve installed all the “Application Development Features” as shown in the screenshot below. They are not installed by default and at least some of them are mandatory for being able to load PHP (I would assume that they are “CGI” and “ISAPI Filters” / “ISAPI Extensions”), but install them all, just to be on the safe side.


Now (from an Administrator command line) go to the “C:Windowssystem32inetsrvconfig” directory and open up the file “applicationHost.config” with notepad. Remove all the references to PHP. Finally, re-add the *php <-> php5isapi.dll script mapping. Make sure that all your apppools are started and now everything should work.

I got some of the advice from this blogpost: Where did my IIS7 server go? Troubleshooting 503 "service unavailable" errors. Picture taken from psd’s photostream with permission.

, ,

4 responses to “Quick tips for installing PHP + IIS7 under Windows 7”

  1. What about if I don’t want to run IIS? In the past under XP and Vista, I did not run IIS. Do I now need it for PHP under Win7?

    What I’m getting under Win7 without IIS is that my PHP commands are echoed back. So by going to localhost, I see the PHP command for the info screen instead of the actual information panels.

  2. @Anonymous – you don’t need to use IIS. In fact installing PHP is easier using Apache, but you can use many different webservers under windows (lighttpd, nginx, etc).

    What I would recommend is the XAMPP package, since it is quite easy to install. I didn’t use it under Windows 7, but there is a very good chance that it will work without a problem. One thing to be aware of however is the security aspect: it is mainly configured as a developer tool, so it is not as tight as you can (and should) be in a production environment. Make sure that you understand the security considerations before you start running a website accessible (and thus attackable) by anyone.

  3. Thanks for the post – could you explain these two steps in a little more detail?

    1) re-add the *php <-> php5isapi.dll script mapping.

    2) Make sure that all your apppools are started

    Thanks again,

    Deck Hazen, [email protected]

Leave a Reply

Your email address will not be published.