Setting Up IIS 7 and PHP Using FastCGI in a Microsoft Window Environment

Published September 24th, 2011


Setting up and managing PHP in a Microsoft Windows environment under Internet Information Services 7 or IIS7 is a fairly easy task when using the Microsoft Web Platform Installer. The following post will walk you through enabling the IIS 7 windows feature along with FastCGI. Afterwards we will use the Microsoft Web Platform Installer to install PHP and the PHP Manager IIS addin. Once finished you will have IIS 7 running PHP using FastCGI as well as an easy way to enable, disable and add extensions to PHP via an easy to use GUI form within the Internet Information Services (IIS) Manager.

First we will need to add the IIS 7 feature to Windows by opening the Control Panel. Under "Programs and features" click on "Turn Windows Features on or off". In the “Turn Windows features on or off” window click once on the "Internet Information Services" check box. This will select the default items needed to run IIS 7. Next expand "Internet Information Services" then expand "World Wide Web Services" then "Application Development Features". You will then need to check the box next to "CGI" under this section in order to run PHP under FastCGI. At this time you may also with to reveiw the other features availble incase you need further support added into IIS 7 but for this post nothing else will need to be added. Once you have selected the wanted features and clicked "OK" you will have completed setting up IIS 7.

Turn Windows Features On Or Off

Once you have completed setting up IIS 7 you will now need to install PHP. In a windows environment I prefer to use the Microsoft Web Platform Installer which can be downloaded here to acomplish this task. After installing the Microsoft Web Platform Installer run the program. A nice tool for configuring PHP in an IIS 7 environment is a tool called PHP Manager for IIS. You can download this add in using the Microsoft Web Platform Installer by doing a seach within the application for "PHP manager". Installing this addin will install PHP for you as well so you will not have to select PHP to install as well unless you wish to use an older version of PHP. Once setup has completed you are now ready to check on your install so far from within the Internet Information Services (IIS) Manager.

Web Platform Installer

Open the Internet Information Services (IIS) Manager from within your administrative tools folder. Expand the sites list on the left and select the site entitled "Default Web Site". In the middle of the window under "Default Web Site Home" under the IIS heading you should find an icon for "PHP Manager". Double click the icon to open the PHP Manager. If the manager is showing any errors or more then likely suggestions go ahead and apply or fix them. Generally the PHP Manager will do this for you it usually just entails check marking a box or two.

Internet Information Services (IIS) Manager

To check that PHP is running properly simply click on the link under PHP Setup entitled "Check phpinfo()". This will display all current PHP information as well as setting for all your installed extensions.

If you wish to disable any existing extensions or enable more extensions This can be done using the link "Enable or disable an extension" found under the "PHP Extentions" heading. To enable or disable extension simply select the extension in question then enable or disable them. To add an extension clcik on "Add an extension" under the same hading and browse to the extensions .dll file.

PHP Manager

That is it you now have IIS 7 running with PHP using FastCGI and a simple way to manage PHP from within the Internet Information Services (IIS) Manager.