title: Trying to run perl scripts with fast-cgi and lighttpd, but file just downloads
body: <p>The problem is my .pl script is downloaded as a blank file instead of being executed.</p>
  
  <p>I read: <a href="http://redmine.lighttpd.net/wiki/lighttpd/ApplicationsUsingLighttpd" rel="nofollow noreferrer">http://redmine.lighttpd.net/wiki/lighttpd/ApplicationsUsingLighttpd</a></p>
  
  <p>My dispatch.fcgi is the following: (it is located in usr/bin/</p>
  
  <pre><code>#!perl
  #!/usr/bin/perl
  use strict;
  use CGI::Fast;
  use Embed::Persistent; {
  my $p = Embed::Persistent-&gt;new();
  while (new CGI::Fast) {
  my $filename = $ENV{SCRIPT_FILENAME};
  my $package = $p-&gt;valid_package_name($filename);
  my $mtime;
  if ($p-&gt;cached($filename, $package, \$mtime)) {
  eval {$package-&gt;handler;};
  }
  else {
  $p-&gt;eval_file($ENV{SCRIPT_FILENAME});
  }
  }
  }
  </code></pre>
  
  <p>This is my code in my lighttpd config file:</p>
  
  <pre><code>".pl" =&gt;
  ((
  "fastcgi.debug" =&gt; 1,
  "bin-path" =&gt; "/usr/bin/dispatch.fcgi",
  "socket" =&gt; "/tmp/fcgi.socket",
  "check-local" =&gt; "disable",
  "min-procs" =&gt; 1,
  "max-procs" =&gt; 5,
  "idle-timeout" =&gt; 20
  ))
  </code></pre>
  
  <p>I had to install CGI.pm and the cpan module embed.
  Now I do not get any errors in my server log, but as I said, the script just downloads.</p>
  
  <p>Thanks for any help!</p>