tanyangxf 发表于 2008-8-17 22:46:23

apache执行cgi程序出错

我把/etc/httpd/conf/httpd.conf下的AddHandler cgi-script .cgi这行注释去掉了
<Directory "/var/www/html/cgi">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
这里是这样做的
执行 chmod a+x /var/www/html/cgi/index.cgi
index.cgi上是这样写的
#!/usr/bin/perl
print"Conten-type;text/plain\n\n";
print"Hello,World!\n";
exit;
然后在浏览器打开http://localhost/cgi/index.cgi
出现了如下错误
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

错误日志里是这样写的
malformed header from script.Bad header=Content-type;text/plain;index.cgi


请问这是怎么了?

linky_fan 发表于 2008-8-19 11:18:16


print"Conten-type;text/plain\n\n";
print"Hello,World!\n";
exit;



print"Content-type; text/plain\n\n";
print"Hello,World!\n";
print"\n";

建议先用sh试试

pagx 发表于 2008-8-19 12:55:41


print"Content-type: text/plain\r\n";
print"Connection: close\r\n";
print"\r\n";
print"Hello,World!\n";
print"\n";

干嘛把 ':' 写成 ';'
页: [1]
查看完整版本: apache执行cgi程序出错