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

纵饮孤独 提交于 2020-02-02 04:23:27

问题


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:


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";
}


来源:https://stackoverflow.com/questions/202578/perl-mod-fcgid-how-can-i-be-sure-its-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!