views:

659

answers:

1

I have a couple Perl scripts I'm taking public soon, and I want to make sure they'll run under mod fcgid in order to keep the server load as low as possible. Previously, I've only ever run scripts that test FastCGI (ie, while ( my $q = new CGI::Fast ) { $count++; echo $count;}) or taken advantage of larger Perl packages (like MovableType) that claim to run as FCGI as long as you set up Apache & FastCGI/mod fcgid properly and change the file suffix to ".fcgi".

So, here's my question: do I need to do anything besides change the file suffix of my scripts, and if so, what?

+1  A: 

You'll need to install FastCGI and configure your Apache to use it, but I assume you knew that. To test if your code is in fact running under FCGI instead of regular CGI, you can use the IsFastCGI method from the FCGI request object, which CGI::Fast uses under the hood.

my $request = FCGI::Request();
if ( $request->IsFastCGI ) { 
    print "we're running under FastCGI!";
} else { 
    print "plain old boring CGI";
}
friedo