关于CGI求助啊
运行CGI程序时出现如下问题:求指导! 没有访问权限?具体要看你怎么配置的了。 回复 2# Mylib权限我设置过,用命令chmod 755mult.cgi 设置过,还是不行。怎么办?
贴一下你的cgi文件的内容吧 回复 4# chenyx
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *data;
long m,n;
printf("%s%c%c ","Content-Type:text/html;charset=utf-8",13,10);
printf("<html> <head>");
printf("<title> the title </title>");
printf(" </head> <body>");
printf("<H3> hahaha </h3>");
data = getenv("QUERY_STRING");
if(data==NULL) printf("<p>no string input!!!</p>");
else if(sscanf(data,"m=%ld&&n=%ld",&m,&n)!=2) printf("<P>num is not enough</P>");
else
printf("<P>the mult is :%ld * %ld =%ld</p>",m,n,m*n);
printf("</body> </html>");
return 0;
}
就是这个相乘的程序。然后生成这样的一个文件。
接下来这个图片是整个服务器里的文件夹
另外,试了另一个thttpd,居然返回404错误,“404 Not Found
The requested URL '/cgi-bin/printenv.sh' was not found on this server.”
这是conf中的配置是这样的:
# This section overrides defaults
dir=/home/httpd/html
#chroot
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
# novhost
cgipat=/cgi-bin/*
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
有问题吗? 回复 5# suxiaoxiao529
我继续贴上我的HTML关键部分
还有这张权限的截图
望大神们给与指点啊!
页:
[1]