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
请问这是怎么了?
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试试
print"Content-type: text/plain\r\n";
print"Connection: close\r\n";
print"\r\n";
print"Hello,World!\n";
print"\n";
干嘛把 ':' 写成 ';'
页:
[1]