脚本标题过早结束 - 什么,我不知道!

发布于 2024-09-19 03:38:24 字数 646 浏览 4 评论 0原文

我尝试在我的服务器上执行一个简单的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

醉南桥 2024-09-26 03:38:24

有很多好的建议:如何对 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.

对风讲故事 2024-09-26 03:38:24

对于在 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.

一抹淡然 2024-09-26 03:38:24

使用CGI模块,例如

use CGI qw/:standard/;
$q = CGI->new;
print $q->header('text/html');
print "testing...\n";     

Use CGI module e.g.

use CGI qw/:standard/;
$q = CGI->new;
print $q->header('text/html');
print "testing...\n";     
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文