Now, to host PHP on IIS successfully you have to perform some following steps:
Step 1: Install IIS Web Server with CGI option in your system.
Step 2: Install PHP for Windows operating system in your system (For more details on PHP Installation click here)
Step 3: Configure PHP configuration file (php.ini) to work with IIS web server
Step 4: Configure FastCGI module to work with PHP
Manually Configure php.ini file to work with IIS web server:
To run PHP on IIS web server you have to make some changes in php.ini file. Let’s take a look about these changes:
Step 1: Set fastcgi.impersonate = 1
Step 2: Set cgi.fix_pathinfo=1
Step 3: Set cgi.force_redirect = 0
Step 4: Set open_basedir to point to that folder or network path where the content of the Web site is located.
Step 5: Set extension_dir to point to that location where the PHP extensions are located. Typically, for PHP 5.2.X the value would be set as extension_dir = "./ext"
Step 6: Enable the required PHP extension by un-commenting the corresponding lines, for example:
extension = php_mssql.dll
Manually Configure FastCGI Module to work with PHP:
To manually configure the IIS and FastCGI extension, you have to perform some following steps:
Step 1: Open Internet Information Services (IIS) Manager (to open IIS manager type ‘inetmgr’ in run command textbox)
Step 2: Double click on ‘Handler Mapping’ and select ‘Add Module Mapping’ from left Action Pane. After that filled appropriate information into textboxes.
Request path: *.php
Executable: "C:\[Path to your PHP installation]\php-cgi.exe"
Name: PHP via FastCGI
After this, just click on ok button.
Now IIS web server is ready for run PHP file or PHP web site.