我不是 Perl 世界的人,所以其中一些对我来说是新的。我正在运行 Ubuntu Hardy LTS,并安装了 apache2 和 mod_fcgid 软件包。我想让 MT4 在 fcgid 而不是 mod-cgi 下运行(它似乎可以在普通的 CGI 下运行)。
我似乎无法让一个简单的 Perl 脚本在 fcgid 下运行。我创建了一个简单的“Hello World”应用程序,并包含了上一个问题中的代码来测试 FCGI 是否正在运行。
我将脚本命名为 HelloWorld.fcgi(当前 fcgid 设置为仅处理 .fcgi 文件)。代码:
#!/usr/bin/perl
use FCGI;
print "Content-type: text/html\n\n";
print "Hello world.\n\n";
my $request = FCGI::Request();
if ( $request->IsFastCGI ) {
print "we're running under FastCGI!\n";
} else {
print "plain old boring CGI\n";
}
Run Code Online (Sandbox Code Playgroud)
当从命令行运行时,它会打印“plain old Boring...”当通过对 apache 的 http 请求调用时,我收到 500 内部服务器错误,并且脚本的输出被打印到 Apache 错误日志中:
Content-type: text/html
Hello …Run Code Online (Sandbox Code Playgroud)