LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1311|回复: 4

谁能解决一下不能执行CGI问题?

[复制链接]
发表于 2006-9-26 17:37:42 | 显示全部楼层 |阅读模式
系统是FC 5,配置HTTP服务后,不能执行CGI。

页面显示错误:
-------------------------------------------------------------------------------------------
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server ...........

More information about this error may be available in the server error log.

-------------------------------------------------------------------------------------------





下面是httpd.conf里面关于CGI 的配置:
-------------------------------------------------------------------------------------------
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
-------------------------------------------------------------------------------------------
全部配置文件看附件1:httpd.rar





下面是错误日志内容:
-------------------------------------------------------------------------------------------
[Tue Sep 26 16:56:12 2006] [error] [client 192.168.0.200] (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed
[Tue Sep 26 16:56:12 2006] [error] [client 192.168.0.200] Premature end of script headers: test.cgi
[Tue Sep 26 16:56:13 2006] [error] [client 192.168.0.200] (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed
[Tue Sep 26 16:56:13 2006] [error] [client 192.168.0.200] Premature end of script headers: test.cgi
[Tue Sep 26 16:56:13 2006] [error] [client 192.168.0.200] (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed
[Tue Sep 26 16:56:13 2006] [error] [client 192.168.0.200] Premature end of script headers: test.cgi
[Tue Sep 26 16:56:20 2006] [error] [client 192.168.0.200] (2)No such file or directory: exec of '/var/www/cgi-bin/env.cgi' failed
[Tue Sep 26 16:56:20 2006] [error] [client 192.168.0.200] Premature end of script headers: env.cgi
[Tue Sep 26 16:56:21 2006] [error] [client 192.168.0.200] (2)No such file or directory: exec of '/var/www/cgi-bin/env.cgi' failed
[Tue Sep 26 16:56:21 2006] [error] [client 192.168.0.200] Premature end of script headers: env.cgi
[Tue Sep 26 16:56:21 2006] [error] [client 192.168.0.200] (2)No such file or directory: exec of '/var/www/cgi-bin/env.cgi' failed
-------------------------------------------------------------------------------------------
详细看附件2:error_log.rar


SElinux已经关闭!
suexec模块也没加载!
可是无法执行CGI,请哪为知道的给个解决的办法!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2006-9-26 18:58:51 | 显示全部楼层
我在配置APACHE+PERL的时候也遇到过这样的状况。

1 要保证 你的APACHE中有mod_cgi 或 mod_perl模块
2 AddHandler cgi-script .cgi 要添加上
3 CGI的文件要755的权限才可以运行 (我的机器上是这样)
4 相对的PERL模块 要存在
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-26 19:45:16 | 显示全部楼层
httpd.congf--> LoadModule cgi_module modules/mod_cgi.so

perl.conf    -->  LoadModule perl_module modules/mod_perl.so

都有加载

--------------

/usr/lib/httpd/modules/mod_perl.so
/usr/lib/httpd/modules/mod_cgi.so

模块也都存在

--------------

权限也不是问题

AddHandler cgi-script .cgi    也加上(其实在/cgi-bin/目录下不加此项也可)

--------------

但!!!!!,还是不能执行啊!

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


高手在 where ?????
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-26 19:51:03 | 显示全部楼层
再附上测试用的文件:
test.cgi :
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";


简单的不能再简单了,在命令行下 用
perl   test.cgi   
能正常输出,为蛤在页面就不能执行呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-27 17:37:59 | 显示全部楼层
哈哈,问题找出来了,是文件格式问题,文件变成了PC格式,换成UNIX格式就好了

这年头......
回复 支持 反对

使用道具 举报

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

本版积分规则

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