windows 通过appache链接cgi程序

1 #!D:Python27
2 
3 print 'Content-type: text/plain'
4 print
5 
6 print 'Hello, world'
出现错误
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server                                         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.
 
查看appache的错误日志发现

[Mon Aug 11 14:51:18 2014] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
[Mon Aug 11 14:53:11 2014] [error] [client 127.0.0.1] (OS 2)系统找不到指定的文件。 : couldn't create child process: 720002: listing15-4.py
[Mon Aug 11 14:53:11 2014] [error] [client 127.0.0.1] (OS 2)系统找不到指定的文件。 : couldn't spawn child process: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/listing15-4.py

一样一样来! 第一个error:favicon.ico文件没找  google后才知道这是个 在地址栏最左边 显示的图片, 个人觉得有没有应该没多大问题, 但还是在线做了个,在线做favicon.ico的网站还蛮多的, 傻瓜式操作。

第二个error:couldn't create child process。  这个是主要的错误, 同时也导致了下面   couldn't spawn child process。   上网搜了一下, 说原因可能是没找到解释器。

于是在开头

1 #!D:Python27
2 
3 print 'Content-type: text/plain'
4 print
5 
6 print 'Hello, world'
1 #!D:Python27python.exe
2 
3 print 'Content-type: text/plain'
4 print
5 
6 print 'Hello, world'
原文地址:https://www.cnblogs.com/yeahpeng/p/3904862.html