Perl FastCGI


  1. Open Web Platform Installer and install "Perl project":
    Perl installation
  2. Open project's home page and follow steps in "CGI" section:
    Perl installation
    Helicon Zoo will run Perl CGI script as FastCGI, i.e. without restarting or reloading script for every request.

  3. Create an example file in the root of web site with the following content.
print "Content-type: text/html\r\n\r\n";
print <<EndOfHTML;

<html><head><title>Perl Environment Variables</title></head>
<body> <h1>Hello from Perl!</h1>
<h2>Perl CGI Environment Variables</h2>
foreach $key (sort(keys %ENV))
  print "$key : $ENV{$key}\n";
print "</code></pre></body></html>";

Output of example perl CGI application:

Perl installation


To deploy Perl FastCGI application you will need to install Perl Hosting Package on a target server. Then just copy IIS web site from one machine to another.

web.config example

<?xml version="1.0" encoding="UTF-8"?>

      <application name="perl.project" >

          <!-- Use this APP_WORKER with PSGI engine -->
          <add name="APP_WORKER" value="" />

          Deploy file includes the most common commands required to prepare application before launch (bundle install, migrations etc.)
          It is also possible to specify here any script which evenually will be run by rubyw.exe.
          <add name="DEPLOY_FILE" value="" />

          <!-- security rules for console are placed in /console/web.config -->
          <add name="CONSOLE_URL" value="console" />


      <!-- All transports below support any Psgi-based application. Uncomment the one you wish to use. -->

      <!-- Perl CGI over FastCGI -->
      <add name="perl.project#x86" scriptProcessor="perl.5.12.pipe" path="*.pl" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
      <add name="perl.project#x64" scriptProcessor="perl.5.12.pipe" path="*.pl" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />


    <!-- URL Rewrite rules to pass static files, limit console access, etc. -->

        <!-- This rule shows welcome page when no Rack application exist. -->
        <rule name="Rewrite to Zoo index if that's an empty application" stopProcessing="true">
          <match url="^/?$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
            <add input="{APPL_PHYSICAL_PATH}" pattern="(.*)" ignoreCase="false" />
            <add input="{C:1}" matchType="IsFile" negate="true" />

          <action type="Rewrite" url="public/zoo-index.html" />