如何配置执行c写的cgi程序

apache配置如下:

ScriptAlias /cgi-bin/ "C:/Apache2/cgi-bin/"

#
# "C:/Apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/Apache2/cgi-bin" >
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory >


test.c代码如下:

#include <stdio.h >
#include <stdlib.h >

int main(void)
{
char* query;

printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10);
printf(" <title >Search Result </title >\n");
printf(" <H3 >Search Result </H3 >\n");

query = getenv("QUERY_STRING");

// Note 1: other functions to truncate the query string

// Note 2: other functions to search for the related documents

// Now, if you find the word and want to display on user "s browser, do

printf("\n <p > word %s is found\n", query);
}


我用MinGW编译程序,把程序放到了

C:\Apache2\cgi-bin\test.exe

但用IE打开:http://localhost/cgi-bin/test.exe

确要我下载.问题出在哪呢?

请各位高手帮忙.
问题点数:20回复次数:6 显示所有回复显示星级回复显示楼主回复
<iframe width="100%" scrolling="no" height="0" frameborder="0" src="http://topic.youkuaiyun.com/u/AD/Topic_Zone.aspx" marginheight="0" marginwidth="0" id="Topic_Zone" style="height: 0pt;"></iframe>
发表于:2007-05-24 15:21:381楼得分:0
上面的配置已经正确了,只是我当时没有重启动apache.
<!-- <span>预留的文字链广告位</span> //-->
发表于:2007-05-29 12:24:352楼得分:0
exe类型允许访问?
<!-- <span>预留的文字链广告位</span> //-->
发表于:2007-05-29 12:46:203楼得分:0
<Directory "C:/Apache2/cgi-bin" >
AllowOverride All
Options All
Order allow,deny
Allow from all
</Directory >
<!-- <span>预留的文字链广告位</span> //-->
发表于:2007-05-30 22:06:144楼得分:0
是的,允许访问的.
我是在windows平台下做测试的.
<!-- <span>预留的文字链广告位</span> //-->
发表于:2007-06-18 15:31:005楼得分:0
遇上了同样的问题...
<!-- <span>预留的文字链广告位</span> //-->
发表于:2007-08-07 09:13:196楼得分:0
httpd中配置的可解析的后缀包含.exe了吗?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值