I’ve had some interest in a patch for FastCGI support so I’ve attached it to this message.  It is also available at:



(I’m not subscribed to the list, so any responses should be copied to me)


It’s a one line change to the Lib.pm to allow for a CGI object to be passed in.  If it’s not passed it does a new CGI() call like it always has.  This allows the fastcgi handler to pass in the CGI::Fast object when being run in FastCGI mode.


The fcgi version is similar to the cgi version, just with the initialization stuff moved outside the loop. (and a loop)


I use this patch with lighttpd to provide a persistent FCGI presence for BackupPC.  It provides advantages, since I can use a UNIX socket to pass requests, I don’t require setuid permissions on the executable since I can use spawn-fcgi to run the processes under the correct UID.  Plus, since actions are included with require within the CGI, the longer the process lives the more of the program will be compiled in memory.


In lighttpd I can call it like so:

$HTTP["url"] =~ "/backuppc" {

  index-file.names = ( "index.fcgi" )

  fastcgi.server = ( "index.fcgi" => (( "socket" => "/tmp/.fcgi_backuppc", "broken-scriptfilename" => "enable" )) )



Where index.fcgi is a blank 0-length file.  (It just has to exist.  You can run the CGI from anywhere, and you’ll do that when you launch the process with spawn-fcgi… Mine lives in /usr/share/backuppc)


I wouldn’t  mind seeing this included in upstream.