脚本标题过早结束 - 什么,我不知道!
我尝试在我的服务器上执行一个简单的 perl 脚本,我得到一个内部 500 服务器,当我检查错误日志时,它显示:
脚本标头提前结束:test.pl
这是 perl 脚本:
#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print "testing...\n";
我的cgi-bin
文件夹的权限为0755。脚本本身也是0755。该脚本归apache所有,属于apache组。该脚本通过命令行运行良好。
有什么问题以及如何解决这个问题?
感谢大家的帮助!
更新
suExec 中有趣的发现:
2010-09-14 17:38:28]: uid: (10001/som) gid: (2522/2522) cmd: test.pl
[2010-09-14 17:38:28]: target uid/gid (10001/2522 or 2521) mismatch with directory (48/0) or program (48/0)
但我的 cgi 文件夹与 test.pl 脚本相同 - 它是否引用另一个目录?
I try to execute a simple perl script on my server and I get an internal 500 server and when I check the error logs it shows:
Premature end of script headers: test.pl
Here is the perl script:
#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print "testing...\n";
My cgi-bin
folder has permissions of 0755. The script itself is also 0755. The script is owned by apache and its in the group apache. The script works fine via the command line.
What is the problem and how can I fix this?!
Thanks all for any help!
Update
Interesting find in suExec:
2010-09-14 17:38:28]: uid: (10001/som) gid: (2522/2522) cmd: test.pl
[2010-09-14 17:38:28]: target uid/gid (10001/2522 or 2521) mismatch with directory (48/0) or program (48/0)
But my cgi-folder is the same as the test.pl script - is it referring to another directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有很多好的建议:如何对 Perl CGI 脚本进行故障排除。
更新看到您的 suexec 错误消息: 看起来您的服务器需要 CGI 程序由与目录相同的用户拥有。尝试更改文件的所有权。
Plenty of good advice: How can I troubleshoot my Perl CGI script.
Update having seen your suexec error message: Looks like your server needs the CGI program to be owned by the same user as the directory. Try changing the ownership of the file.
对于在 PerlMonks 上给出错误消息的 Perl 脚本,有很多很好的故障排除建议:从这里开始。我在您的脚本中没有看到任何具体错误,而且看起来您已经涵盖了文件权限,因此我将从 Apache 配置建议开始。
There are a lot of good troubleshooting suggestions for Perl scripts giving that error message on PerlMonks: start here. I don't see any specific errors in your script, and it looks like you've covered the file permissions, so I'd start with the Apache configuration suggestions.
使用CGI模块,例如
Use CGI module e.g.