在Apache中运行CGI脚本

时间:2013-07-21 09:58:46

标签: windows apache cgi

我在Windows XP上使用Apache 2.4.4。在尝试运行CGI脚本时,浏览器会给出 “500内部服务器错误”我试图通过各种论坛后解决,但到目前为止没有运气 我的httpd.conf文件如下:

<IfModule alias_module>
ScriptAlias /cgi-bin/ "D:/config/apache/cgi-bin/"

</IfModule>

<IfModule cgid_module>
#Scriptsock cgisock
</IfModule>

<Directory "D:/config/apache/cgi-bin/">
AllowOverride All
Options Includes ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>

我也查看了错误日志,这就是问题所在:

[win32:error] [pid 3824:tid 1216] [client 192.168.1.4:1728] AH02102:      D:/config/apache/cgi-bin/printenv.pl is not executable; ensure interpreted scripts have "#!" or "'!" first line
[cgi:error] [pid 3824:tid 1216] (9)Bad file descriptor: [client 192.168.1.4:1728] AH01222: don't know how to spawn child process: D:/config/apache/cgi-bin/printenv.pl

请,任何帮助都是高度Apreciated。 提前致谢

1 个答案:

答案 0 :(得分:0)

我猜你的后端cgi消费者程序是你的printenv.pl的perl。

错误很明显,apache不知道如何处理这个printenv.pl文件。

你需要告诉apache如何通过修改apache配置文件来解释它。

checkout mine.types

结帐如下。可能会有所帮助。

Is it possible to run a batch file as a cgi in apache under windows?