简体   繁体   English

运行Perl代码时出现内部服务器错误

[英]Internal Server Error when the perl code run

I am getting the internal server error when run the perl script.I put the file into the cgi-bin folder and set the permission 755. please let me know the How can I resolve this? 运行perl脚本时出现内部服务器错误。我将该文件放入cgi-bin文件夹并设置了权限755。请让我知道该如何解决?

There are two files in cgi-bin folder.One is perldigger.cgi. cgi-bin文件夹中有两个文件。一个是perldigger.cgi。 It is working fine its url is http://mts.marketsignalsoftware.com/cgi-bin/perldigger.cgi and the 2nd is test.cgi. 它工作正常,其网址是http://mts.marketsignalsoftware.com/cgi-bin/perldigger.cgi ,第二个是test.cgi。 It is giving the internal error. 它给出了内部错误。 I wrote the simple code into it and url is http://mts.marketsignalsoftware.com/cgi-bin/test.cgi . 我在其中编写了简单的代码,其网址为http://mts.marketsignalsoftware.com/cgi-bin/test.cgi

 #!/usr/bin/perl -w
 # Program to do the obvious
 print 'Hello world.';      
 # Print a message 

Thanks 谢谢

Check your error logs and you will see a message about missing headers, maybe something like Premature end of script headers ... . 检查您的错误日志,您将看到一条有关缺少标题的消息,可能是类似Premature end of script headers ... The first output of a CGI script should always be a content type header. CGI脚本的第一个输出应始终为内容类型标头。

Try 尝试

#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print 'Hello world.';

Obligatory trouble shooting link for the next problem you have: 下一个问题的强制性故障排除链接:

How can I troubleshoot my Perl CGI script? 如何解决我的Perl CGI脚本问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM