Part 2 - Install FastCGI on the web server

FastCGI and IIS 7

The FastCGI component is built-in to Microsoft IIS 7 (on Windows Server 2008 and Windows Vista SP1) but it is an optional component and is not installed as part of the "vanilla" Server 2008 or Vista setup. You have to manually install it. See the Using FastCGI to Host PHP Applications on IIS 7.0 article on iis.net for instructions on how to do this.

If you are running IIS 7 you can skip this section and go right ahead and install PHP after you've enabled FastCGI in IIS.

  1. Download the FastCGI MSI installer (fcgisetup32.msi) from the IIS.net web site.
  2. Run the fcgisetup32.msi installer. It will extract the following files into your C:\WINDOWS\system32\inetsrv folder.
    • fcgiext.dll
    • fcgiext.ini
    • fcgireadme.htm
    • fcgilicense.rtf
    • fcgiconfig.js
  3. Apart from a whole lot of documentation about the various settings that you can configure, the fcgiext.ini file is empty. Add the following to the end of the fcgiext.ini file:
          [Types]
          php=PHP
    
          [PHP]
          ExePath=C:\PHP\php-cgi.exe
          InstanceMaxRequests=10000
          EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000
          ActivityTimeout=300
          

    NOTE

    The ExePath variable must point to the folder where you installed PHP (if you did not use C:\PHP).

    You can also do the above fcgiext.ini file configuration via the command line:

    1. Open a command line window and change to the C:\Windows\System32\Instsrv folder.
    2. Enter the following commands:
      • cscript fcgiconfig.js -add -section:"PHP" -entension:php -path:"C:\PHP\php-cgi.exe"
      • cscript fcgiconfig.js -set -section:"PHP" -InstanceMaxRequests:10000
      • cscript fcgiconfig.js -set -section:"PHP" -EnvironmentVars:PHP_FCGI_MAX_REQUESTS:10000
      • cscript fcgiconfig.js -set -section:"PHP" -ActivityTimeout:300
      If these commands are successful you will get a "INI successfully written" message after each command:


    3. NOTE

      It is not necessary to run the above commands on the command line if you manually added the PHP settings to the fcgiext.ini file as described in point 3 above. The command line is just an alternative way to configure the fcgiext.ini file.

  4. FastCGI is now installed on the web server. You now need to configure IIS for PHP and add the script mapping for the .php extension so that the web server knows how to process .php files.


    Back | Home | Next
    Contact