In this article, we will see how to configuring FastCGI to Host PHP Applications in IIS 7 in Window Server 2008 R2. To configuring FastCGI in IIS, make sure that CGI is enable in IIS 7. Let's start
Go to Control panel -> Administrative Tools -> Server Manager -> Add Role Services. Select Role Services Window, checked CGI check box, click Next button to continue as shown in below figure.
This will enables both CGI and FastCGI services.
Download php Zip file from here. Unzip PHP zip file to location c:\php, or choice your location your self. Find php.ini file in PHP folder from where you have unzip php folder, copy php.ini file to c:Window\php.ini.
Go to Control Panel -> Administrative Tools, open Internet Information Services (IIS) Manager or write “inetmgr.exe” in your Run command.
In Internet Information Services (IIS) Manager select [SERVER NAME] under the Start Page. Double click on Handler Mappings as show in below figure.
In the Actions pane, click Add Module Mapping hyperlink. Add Module Mapping dialog box will opened.
Enter the following configuration settings as
- Request path: *.php
- Module: FastCgiModule
- Executable: C:\php\php-cgi.exe
- Name: PHP viaFastCGI
Click Yes button to create a FastCGI applicaton for executable.
Now your PHP is configured successfully.
To test PHP work correctly, create a index.php file in the C:\Inetpub\wwwroot folder
Open index.php file and paste following line of code as given below.
Enter http://localhost/index.php URL in your web browser. If settings will be shown in the index.php page then its mean php is working perfectly.