IIS and FastCGI/Registering interpreter

This page is largely a wiki-mirror of the official Microsoft docs.[1]

Configuring FCGI.ini

edit

To register an extension globally:

## php
cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"C:\PHP\php-cgi.exe"

## perl
cscript fcgiconfig.js -add -section:"Perl" -extension:pl -path:"C:\strawberry\perl\bin\perl.exe"

To register a site-specific extension simply add the -site=<sitenum> flag. (No angle brackets)

cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"C:\PHP\php-cgi.exe" –site:1

On success you should see:

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

INI successfully written.

Finishing fcgiext.ini

edit

Documented is located by default in: C:\WINDOWS\system32\inetsrv\fcgiext.ini

The FastCGI document is formatted with a Types section that maps the FastCGI application onto the IIS site (vhost) using the specific IIS ids. And, a section that describes the application:

[Types]
;619896678 is my example IIS site id
*:619896678=Catalyst

[Catalyst]
ExePath=C:\strawberry\perl\bin\perl.exe
Arguments="D:\Inetpub\www\DMApp\script\dmapp_fastcgi.pl"

Registering FCGI with IIS

edit

To add the FastCGI to a site follow these steps: Start → Administrative Tools → Internet Information Services (IIS) Manager → Right Mouse click on Web Sites folder Properties → Home Directory → Configuration → Select extension you installed → Edit → you should see C:\WINDOWS\system32\inetsrv\fcgiext.dll or the like in the executable field. Uncheck verify file exists.

Troubleshooting

edit

ScriptMap already exists

  • Example:
C:\WINDOWS\system32\inetsrv\fcgiconfig.js(1223, 5) (null): ScriptMap already exi
sts, path=IIS://localhost/W3SVC, scriptmap=.pl,C:\Perl\bin\perl.exe "%s" %s,5,GE
T,HEAD,POST
  • Cause: Often old Active State CGI garbage
  • Solution: Start → Administrative Tools → Internet Information Services (IIS) Manager → Right Mouse click on Web Sites folder Properties → Home Directory → Configuration → Delete all conflicting extensions i.e. .pl, .plex, .plx, .php, .rb etc. → OK / Confirm

Footnotes

edit
  • ^ Information based on examples graciously provided by Microsoft: "Using FastCGI to Host PHP Applications on IIS 6.0 and IIS 5.1". IIS And FastCG. Microsoft. 2007-09-24. Retrieved 2008-02-05.