红联Linux门户
Linux帮助

THTTPD,识别不了.cgi文件

发布时间:2009-09-06 21:32:22来源:红联作者:yaopinghl
我在客户端点击“提交”时,出现的不是预期的login.cgi页面,而是给出了下载的Login.cgi文件的页面,怎么回事呢?
我的thttpd服务器显示html页面正常,thttpd.conf配置文件设置如下:

# This section overrides defaults
dir=/home/httpd/html
#chroot #屏蔽chroot是为了运行动态编译的CGI
user=httpd# default = nobody
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid
# This section _documents_ defaults in effect
#port=80
# nosymlink# default = !chroot
#symlinks
# novhost
cgipat=/cgi-bin/*#声明CGI程序的目录,是以dir为根目录的路径
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1

如果perl编写的login.cgi返回的是html页面,即print"Content-type:text/html"...我的点击主页里的提交后,得到的页面为:
#!/usr/local/bin/perl print "Content-type:text/html","\n\n"; print "","\n"; print "","\n"; print "","\n"; print "","\n"; print "","\n"; print "
get message from url
","\n"; $Querystringfromenv=$ENV{QUERY_STRING}; @Nameandvaluelists=split(/&/,$Querystringfromenv); foreach $nameandvalue(@Nameandvaluelists) { ($Name,$Value)=split(/=/,$nameandvalue); $Name=~tr/+//; $Value=~s/%([\dA-Fa-f][\dA-Fa-f])/pack("c",hex($1))/eg; print"name=$Name,value=$Value",
\n"; } print "","\n"; print "","\n";
好像就是识别不了CGI,把源代码几乎都显示出来了。大侠们多多指教!
文章评论

共有 3 条评论

  1. freeice 于 2009-09-06 21:42:09发表:

    底子太差了没有看出来该怎么回答!!

  2. freeice 于 2009-09-06 21:42:01发表:

    底子太差了没有看出来该怎么回答!!

  3. freeice 于 2009-09-06 21:41:03发表:

    进来看一下,看能不能帮助。。。

    我也有好多问题。。大家去看一下。能不能帮我解决嘛!!!谢谢!!!