Wednesday, September 10, 2008

IIS 5.1 and IIS 6.0 Fastcgi and Perl Install in a Test Configuration

Originally posted on

After spending a good bit of time with Google and through trial and error I have found a configuration that appears to support perl using FastCGI on IIS 5.1 and IIS 6.0 using MS's FastCGI Extension for IIS6.0. I have tested it out on a limited basis using both IIS 5.1 on WinXp and IIS 6.0 on a virtual machine copy of Windows 2003 Server running on top of WinXP.

With this setup you setup a specific perl routine to run every time a URL with a specific extension is entered. What use this is I will leave up to you to decide.

A good description of how to configure FastCGI that focuses on PHP:

Here are the steps that I took to make it work with perl.

  1. Configure IIS on both platforms using the default choices.
  2. Download and install ActivePerl using the msi installer and the default choices. Downloaded from:
  3. Using the ppm utility from ActivePerl install the FCGI module from the ActiveState PPM repository.
  4. Download and install FastCGI using default options. Downloaded from: and check to make sure fcgiconfig.js, fcgiext.dll and fcgiext.ini were all present in c:\windows\system32\inetsrv.
  5. In "Local Security Settings" under "User Rights Assignment" add the "Network Service" to "Access this computer from the network". This took me a while to figure out. Now I need to think about potential side effects.
  6. Using the Internet Information Services manager program:
    1. Select properties for the "Default Web Site" and then go to the "Home Directory" tab and select "Configuration..." to get "Application Configuration" window.
    2. Select "Add" to get the "Add/Edit Application Mapping" window.
    3. Under "Executable:" browse to c:\windows\ststem32\inetsrv\fcgiext.dll and select it.
    4. Once back at the "Add/Edit Application Mapping" select the value in the "Executable:" window. If you don't do this you will never be able to select "OK". See for further details.
    5. Type in .fcgi into the "Extension" field.
    6. Check to make sure the "Script Engine" box is checked
    7. The documentation says that "File Exists" must be checked but based on initial tests this is not the case.
    8. Press OK.
  7. Using the Services I restart the "World Wide Web Publishing" service.
  8. Edit fcgiext.ini to include the lines below at the bottom. Note that what this is going to do is run the perl routine in printenv.fcgi every time you enter anything with an ".fcgi" extension. If you have not selected the checked the "File Exists" above then there will be no checking to make sure the file even exists.

  9. Placed printenv.fgci into the c:\inetpub\wwwroot directory.
    use FCGI;
    while (FCGI::accept() == 0) {
      print "Content-type: text/html\r\n\r\n";
      while (($key, $val) = each %ENV) {
        print "$key = $val\n";

At this point printenv.fcgi will run every time you enter the following URL Again note if you have not selected "File Exits" when you setup the application mapping no checking to see if the file on the URL actually exists. In this case will also run printenv.fcgi.

No comments: