【发布时间】:2014-07-22 13:37:53
【问题描述】:
我将我的脚本移到了一个配置几乎相同的新服务器(apache/centos),但从那以后 cgi-bin 一直无法工作。在过去的一周里,我搜索了所有可能的解决方案,并通过从命令行执行脚本来隔离错误。对于一个简单的测试文件,我得到的输出如下:
[root /var/foo/public_html/cgi-bin]# perl -dd /var/foo/public_html/cgi-bin/test.cgi
Loading DB routines from perl5db.pl version 1.32
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(/var/foo/public_html/cgi-bin/test.cgi:2):
2: print "Content-type: text/plain\n\n";
Unknown error
Compilation failed in require at /usr/local/share/perl5/Term/ReadLine/Perl.pm line 63.
at /usr/local/share/perl5/Term/ReadLine/Perl.pm line 63
Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x18ac160)', 'GLOB(0x182ce68)') called at /usr/share/perl5/perl5db.pl line 6073
DB::setterm called at /usr/share/perl5/perl5db.pl line 2237
DB::DB called at /var/foo/public_html/cgi-bin/test.cgi line 2
Attempt to reload Term/ReadLine/readline.pm aborted.
Compilation failed in require at /usr/local/share/perl5/Term/ReadLine/Perl.pm line 63.
END failed--call queue aborted at /var/foo/public_html/cgi-bin/test.cgi line 63.
at /var/foo/public_html/cgi-bin/test.cgi line 63
[root /var/foo/public_html/cgi-bin]#
我正在使用的测试文件的代码是:
#!/usr/local/bin/perl
print "Content-type: text/plain\n\n";
print "testing...\n";
我检查了 perl、perl 版本等的路径,一切似乎都正常。但是脚本没有执行并给出 500 内部服务器错误。我正在使用 dso 处理程序和 susEXEC 运行 php5。 susEXEC 日志除了调用了 cgi 脚本外什么也没说。这个问题完全让我感到困惑,我对 cgi/perl 的一点经验也没有帮助。谁能指出我正确的方向来解决这个问题?
【问题讨论】:
-
Term::ReadLine::Perl 由调试器使用,而不是您的脚本。
-
如果在 cgi-bin 目录中运行
ls -l test.cgi和./test.cgi会发生什么? -
@mark 我得到这个输出 -rwxr-xr-x 1 foouser foouser 82 Jul 22 18:49 test.cgi
-
sh: ./test.cgi: 权限被拒绝
-
您的 Apache 配置文件中有
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/和Options +ExecCGI吗?