饲育系少女x百度网盘:window下如何配置apache支持c语言编写的cgi?

来源:百度文库 编辑:高校问答 时间:2024/04/30 21:27:45
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

我在按照下面的要求在httpd.conf里头配置好apache如下:
ScriptAlias /cgi-bin/ "E:/apache2/Apache2/cgi-bin/"
<Directory "E:/apache2/Apache2/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

AddHandler cgi-script .exe .pl .cgi

说明:
1)"E:/apache2/Apache2/cgi-bin/"为我安装apache2的目录下的cgi-bin目录
2)为了能够支持c语言编写cgi,我在addhandler后面增加了一项.exe

然后我用c写了一个这样的cgi
/*HELLO.C -- Hello, world */
#include <stdio.h>
int main(void)
{
printf("Content-Type:text/html;charset=iso-8859-1\n\n");
printf("Hello, world\n");
return 0;
}

用turboc2编译后,放置到cgi-bin目录下,
然后通过http://localhost/cgi-bin/hello.exe
出现如下错误:

Please contact the server administrator, admin@lzu.edu.cn and inform them of the time the error occurred, and anything you might have done that may have caused the error.

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

查看error.log时,看到的错误提示如下:
[Sat May 13 11:45:50 2006] [error] [client 219.246.177.90] (OS 5)拒绝访问。 : couldn't spawn child process: E:/apache2/Apache2/cgi-bin/HELLO.EXE

后来查找资料后还是没有解决,请高手帮忙!

猜猜一下,应该是编译器的问题吧,apache能解析.exe么?

用cgic 库写。有例子。

www.gnu.org找cgic library