我的Perl程序可以从命令行正常工作,但不能作为网页。
这是我的剧本:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html>\n";
print "<title> PERL CGI</title>\n";
print "<body>";
print "hello perl-cgi!!!!!!!";
print "</body>";
print "</html>\n";
wepbage的错误是:Internal Server Error
错误日志错误:
[Tue Oct 04 10:04:41 2016] [error] [client 172.23.40.113] (8)Exec format error: exec of '/var/www/html/test2.pl' failed [Tue Oct 04 10:04:41 2016] [error] [client 172.23.40.113] Premature end of script headers: test2.pl
以下是/etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
Options ALL
AllowOverride None
Order allow,deny
Allow from all
Options +ExecCGI -Indexes
AddHandler cgi-script .cgi .pl </Directory>
这些是www/html
目录
786875 -rwxr-xr-x. 1 root root 16 3. ĹĂj 10.54 incex.html
786669 -rwxr-xr-x. 1 root root 22 27. zåŠ10.00 index.html
786688 -rwxr-xr-x. 1 root root 21 3. ĹĂj 08.47 info.php
786899 -rwxr-xr-x. 1 root root 2765 3. ĹĂj 14.51 test.pl
786834 -rwxr-xr-x. 1 root root 161 3. ĹĂj 15.36 test2.cgi
786833 -rwxr-xr-x. 1 root root 259 4. ĹĂj 11.43 test2.pl
答案 0 :(得分:0)
感谢您的帮助.. 现在它的工作..问题很简单(和愚蠢)。我没有在nano中看到它..我的脚本在第二行开始..所以它不是以#!/ usr / bin / perl开头