QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1528|回复: 2

apache执行cgi程序出错

[复制链接]
发表于 2008-8-17 22:46:23 | 显示全部楼层 |阅读模式
我把/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.

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


请问这是怎么了?
发表于 2008-8-19 11:18:16 | 显示全部楼层
print"Conten-type;text/plain\n\n";
print"Hello,World!\n";
exit;


  1. print  "Content-type; text/plain\n\n";
  2. print  "Hello,World!\n";
  3. print  "\n";
复制代码

建议先用sh试试
回复

使用道具 举报

发表于 2008-8-19 12:55:41 | 显示全部楼层

  1. print  "Content-type: text/plain\r\n";
  2. print  "Connection: close\r\n";
  3. print  "\r\n";
  4. print  "Hello,World!\n";
  5. print  "\n";
复制代码

干嘛把 ':' 写成 ';'
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-5-27 20:58 , Processed in 0.086125 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表