出于某种原因,我不能让一个perl脚本在cgi-bin文件夹中运行。 我没有做这些文件,我们已经上传到另一台服务器,他们工作正常。
但是我已经使用了下面的test.pl文件,通过bash(以root身份)和浏览器正常工作。
#!/usr/bin/perl use strict; use warnings; #Useful for testing: Perl error messages, plus your die statements, will get #sent to the browser. Otherwise you will just see "Internal Server Error". use CGI::Carp qw/fatalsToBrowser/; #Always use the CGI module for your scripts. use CGI; #Create simple HTML output (taken directly from CGI documentation). my $q = CGI->new; # create new CGI object print $q->header, # create the HTTP header $q->start_html('hello world'), # start the HTML $q->h1('hello world'), # level 1 header $q->end_html; # end the HTML
其他正在运行的脚本使用完全相同的权限和设置。 但是,除非我将#!/usr/bin/perl的第一行更改为#!/usr/bin/perl -w (带有警告),否则脚本会提示500错误消息。 错误日志输出以下错误,当我运行它没有-w 。
错误日志:
[Fri Sep 26 12:06:03 2014] [error] [client xxx.xxx.xx.xxx] (2)No such file or directory: exec of '/var/www/html/foldername/cgi-bin/ss000001.pl' failed [Fri Sep 26 12:06:03 2014] [error] [client xxx.xxx.xx.xxx] Premature end of script headers: ss000001.pl
我应该注意到,我可以做nano /var/www/html/foldername/cgi-bin/ss000001.pl ,它打开文件并将perl更改为-w ,如上所述。
有没有人知道我可以在哪里开始或看到什么马上就错了?