我想配置我的服务器后运行一个简单的CGI脚本。简单的CGI脚本内部服务器错误(500)
我的剧本是这样的:
print "Content-type: text/html"
print
print "<html><head><title>CGI</title></head>"
print "<body>"
print "hello cgi"
print "</body>"
print "</html>"
当我去我的脚本URL http://127.0.0.1/~flybywire/cgi-bin/main.py
我得到:
内部服务器错误
服务器遇到一个内部错误或配置错误并无法完成您的请求。
而在error.log
我得到如下:
[error] (8)Exec format error: exec of '/home/flybywire/www/cgi-bin/main.py' failed [error] [client 127.0.0.1] Premature end of script headers: main.py
其他信息:Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 Server at 127.0.0.1 Port 80
谢谢你,它的工作原理。 – flybywire
我想给所有的cgi脚本添加'#!/ usr/bin/python'是很可怕的。如何通过apache SetEnv设置PYTHONPATH? – gonjay