Jim
Jim

Reputation:

Perl & mod_fcgid- how can I be sure it's working?

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?

Upvotes: 5

Views: 2398

Answers (1)

friedo
friedo

Reputation: 66947

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.

use FCGI;

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

Upvotes: 3

Related Questions