How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

FastCGI is a regular protocol which enables a Web Server to interface with CGI executable files of app structure. The windows most current PHP 4.4.x and PHP 5.x distribution totally support this FastCGI Extension.

This article provides step by step description of how to install PHP on the IIS7 or IIS8 through FastCGI interface.  You will learn steps to follow to install FastCGI and set it up to work with PHP.Follow these tips and steps to install FastCGI Extension for IIS 7 / IIS 8 Windows Server:

Step 1: Integrate The CGI Role Services

To do this, Navigate to the Server Manager, click on the option labeled “Roles” and then Click on the Add Role Services.

This action immediately enables both the CGI and also FastCGI services: Below is a pictorial step to help you.

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

Step 2: Include the CGIs Features (For Windows Vista SP1 and Windows 7)

In order to do this, navigate into the Control Panel of your system and click on the Programs and Features submenu. Select the “Turn Windows features on/off” option. Note that doing this would enable the services of FastCGI and also the CGI.

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

Step 3: Download PHP And Install It On Your System

When done with the features setting, make a download of the most current PHP Version 5.6 Family. When downloading, ensure you select the ZIP file tagged VC11 x86 Non Thread Safe.

Step 4: Extract the PHP Files contents

After it is downloaded, extract the PHP Files contents to any of your server’s. Then, double the php.ini-production files by making another copy which you name php.ini. Then open that second file,php.iniand complete the parameters below, by setting it up. Already, every single parameter is there, all you need to do, is locate it, delete the indentations (“”) and finally ensure the values are changed. You should be careful to note that the shown options aren’t more than one in the file (php.ini).

Memory limit = 256M
post max size = 128M
extensiondir = "C:PHPext"
upload_tmp_dir = "C:PHPupload"
upload_max_filesize = 128M
max_execution_time = 600
max_input_time = 600
max_input_vars = 2000
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
fastcgi.impersonate = 1
session.save_path = "C:PHPsession"
session.use_cookies = 1

Step 5: Load the extensions

When loading your extensions, ensure they follow the order in the highlighted box above. Also, note that "php_mbstring.dll"is to be loaded before the "php_exif.dll". Follow this Order when Loading Extensions:

i: Create Sub Directories

Create two sub-directories named “session” and “upload” in the directory of the C:PHP. It is not mandatory to use these names but just ensure they are matched with the session. save_path and upload_tmp_dirparameters you configure inside the php.ini.

ii: Configure Date/Time Zone

Ensure you set up in the php.ini, the date.timezone parameter. Below is a little example. Make sure the city you choose is either the city you stay in or one from the same time zone as yours. The linkfull list of possible date.timezone values on websites shows the list of all possible date/time zones.

date.timezone = "America/New_York"

iii: Save the file

When you are sure you have done these, then have the “.ini” file saved.

Step 6: Run PHP command line

In order to check if installing the PHP was successful, then run immediately, the command line thus

C:PHP>php -i

If PHP Fails to Start

The compiler for Visual Studio 2008 is used to compile the VC9 Versions and their stability and performance have been improved. You are to install the Microsoft 2008 C++ Runtime (x64) or the Microsoft 2008 C++ Runtime (x86) for the VC9 versions. In situations when PHP can’t start, downloading an old Windows Versions with the above-listed extensions might be a necessity for you.

Step 7: Configure IIS 7 to Handle PHP Requests

Adding a handler mapping which tells the IIS to transfer through FastCGI Protocol, particular requests to the Framework of the PHP application is vital to enable PHP applications to be hosted by IIS 7. You can either use IIS Manager or the command line to do this.

Step 8: Configure IIS 7 to Handle PHP Requests Through the IIS Manager

In order to make use of the IIS Manager, ensure you follow the below steps carefully.

I: Open Handler Mappings

Enter into the IIS Manager at the level of the server where you would see a menu, the click the Handler Mappings sub-menu.

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

II: Set the Configuration

Choose the action tagged Add Module Mapping, and pinpoint the settings for configurations as in the image below.

This is the format in filling the data:

Request path: *.php

Module: FastCgiModule

Executable: "C:PHPphp-cgi.exe"

Name: PHP via FastCGI

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server


You should note that if you don’t see in the modules space,"FastCgiModule"drop-down menu, it entails that the module has either not been enabled or registered. To confirm that FastCGI module has been registered, access the IIS configuration file%WINDIR%windowssystem32configapplicationHost.configand confirm the line is also in the section of the <globalmodules>.

<add name="FastCgiModule" image="%windir%System32inetsrviisfcgi.dll" />

In that exact file, confirm that the <modules> section has had the FastCGI module added to it like the highlighted path below.

<add name="FastCgiModule" />

Then respond, yes, to the pop-up menu like stated below:

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

Step 9: Set a FastCGI Configuration for Optimal Performance

Be sure to install on your server, the IIS 7 Administration Pack because if you don’t, then you won’t be able to see the settings option for configuring FastCGI.

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

Step 10: Configure a Default Document in IIS

Index.php is a file used by most PHP applications as their application documents for default. So you must handle the file as the content page for default by configuring IIS with the following steps below.

I: Open the Default document

At the level of the server first, click the IIS Manager open and choose default document. The image below would give you a good hint.

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

II: Fill “index.php” in the space

On its opening, select add and then fill the index.php link into the space as displayed below.

How to Install PHP with FastCGI Extension on IIS 7 / IIS 8 Server

Step 11: Test the PHP CGI

After the FastCGI extension has been installed by you, registered the PHP CGI and configured it, then you will be able to easily use the KMP. Then in order to let all the changes you made apply fully, try and restart the IIS server.


We have covered all you need to install a FastCGI extension. You should by now comfortably carry out the operations on your own if you carefully followed the steps. However, if you are still experiencing issues, we are here to help!

Check out these top 3 Best web hosting services

Was this article helpful?