FastCGI <fastCgi> OverviewCompatibilitySetupHow ToConfigurationSample Code Overview The <fastCgi> element contains a collection of <application> elements, each of which creates a FastCGI application pool definition. Internet Information Services (IIS) 7 includes the FastCGI component. This component gives you greater reliability and better performance and lets you run the PHP application framework and other Web application frameworks on IIS 7. The simplest FastCGI application pool definition requires that you include the fullPath attribute in an <application> element to define the binaries to use for the specific application framework. For the PHP framework, set the fullPath attribute to the directory and file name of the PHP binaries. Other attributes are optional and let you configure a number of other parameters. These include the maximum number of requests that a FastCGI worker process can process before it is recycled, the maximum number of worker processes for an application pool, and the maximum amount of time a FastCGI request can take. Note: In order to process requests by using FastCGI, you must first map the path and the specific file name extensions to the FastCGI module and specify the target FastCGI process as the script processor. NEW IN IIS 7.5 IIS 7.5 added the following attributes to the <fastCgi>/<application> element: The monitorChangesTo attribute lets you specify a file to monitor for changes that might affect the behavior of a FastCGI application. For example, if you use the PHP framework, you can configure IIS to monitor the PHP.INI file for changes by specifying the full path to the file in the monitorChangesTo attribute. The stderrMode attribute specifies how IIS 7 will handle errors that are returned from a FastCGI application through the STDERR stream. The signalBeforeTerminateSeconds attribute lets you configure IIS to wait for a specified period of time after IIS signals a FastCGI application that it needs to shut down. This lets a FastCGI application clean up any settings before IIS terminates the process. Compatibility Version Notes IIS 8.5 The <fastCgi> element was not modified in IIS 8.5. IIS 8.0 The <fastCgi> element was not modified in IIS 8.0. IIS 7.5 The <application> element of the <fastCgi> collection was updated in IIS 7.5 with the monitorChangesTo, stderrMode, and signalBeforeTerminateSeconds attributes. IIS 7.0 The <fastCgi> element was introduced in IIS 7.0. IIS 6.0 N/A Setup To use the FastCGI environment, you must first install the CGI role service. The installation process registers the Common Gateway Interface (CGI) role service in both the <globalModules> and <modules> elements. You do not need to perform any other steps to install the FastCGI environment. WINDOWS SERVER 2012 OR WINDOWS SERVER 2012 R2 On the taskbar, click Server Manager. In Server Manager, click the Manage menu, and then click Add Roles and Features. In the Add Roles and Features wizard, click Next. Select the installation type and click Next. Select the destination server and click Next. On the Server Roles page, expand Web Server (IIS), expand Web Server, expand Application Development, and then select CGI. Click Next. . On the Select Features page, click Next. On the Confirm installation selections page, click Install. On the Results page, click Close. WINDOWS 8 OR WINDOWS 8.1 On the Start screen, move the pointer all the way to the lower left corner, right-click the Start button, and then click Control Panel. In Control Panel, click Programs and Features, and then click Turn Windows features on or off. Expand Internet Information Services, expand World Wide Web Services, expand Application Development Features, and then select CGI. Click OK. Click Close. WINDOWS SERVER 2008 OR WINDOWS SERVER 2008 R2 On the taskbar, click Start, point to Administrative Tools, and then click Server Manager. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS). In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services. On the Select Role Services page of the Add Role Services Wizard, select CGI, and then click Next. On the Confirm Installation Selections page, click Install. On the Results page, click Close. WINDOWS VISTA OR WINDOWS 7 On the taskbar, click Start, and then click Control Panel. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off. Expand Internet Information Services, then select CGI, and then click OK. How To Note for IIS 7.0 users: Some of the steps in this section may require that you install the Microsoft Administration Pack for IIS 7.0, which includes a user interface for FastCGI settings. To install the Microsoft Administration Pack for IIS 7.0, see the following URL: http://www.iis.net/expand/AdministrationPack HOW TO CREATE A GLOBAL FASTCGI HANDLER MAPPING FOR PHP Note: Before the following procedure will work, you must have already installed binaries that will execute the file path or file name extension that you specify. This example uses a PHP implementation available from www.php.net. Open Internet Information Services (IIS) Manager: If you are using Windows Server 2012 or Windows Server 2012 R2: On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager. If you are using Windows 8 or Windows 8.1: Hold down the Windows key, press the letter X, and then click Control Panel. Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager. If you are using Windows Server 2008 or Windows Server 2008 R2: On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager. If you are using Windows Vista or Windows 7: On the taskbar, click Start, and then click Control Panel. Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager. In the Connections pane, click the server name for which you want to configure FastCGI handler mappings. In the Home pane, double-click Handler Mappings. In the Actions pane, click Add Module Mapping... Enter the following information: Enter the file name extension in the Request path text box. For example, "*.php". Click FastCgiModule in the Module drop-down list. Enter the path to the scripting engine in the Executable box. For example, "C:\PHP\php-cgi.exe". Enter a unique name for the handler mapping in the Name box. For example, "PHP-FastCGI". Click Request Restrictions... Select Invoke handler only if request is mapped to. Click to select the File or Folder option. Click OK. Click OK. If you are prompted to create a FastCGI application in the Add Module Mapping dialog box, click Yes. Note: This will automatically create a FastCGI application for the handler mapping that you just created. If you choose No, you can manually create a FastCGI application later.