【发布时间】:2014-06-03 22:10:33
【问题描述】:
我遇到了一个我最近搬到的 vps 的问题。我正在尝试运行 python cgi 脚本,但我得到一个 apache Premature end of script headers 错误。
(我 chmod +x 脚本文件)
脚本很简单:
#!/usr/bin/env python
import cgi, cgitb
cgitb.enable()
print "Content-type: text/html"
print "<html><body>hello scritp</body></html>"
现在,如果我将脚本命名为 test**.py**,它在服务器上运行良好。但如果我以正确的方式进行操作,调用它 test**.cgi** 我会收到内部服务器错误。
我从终端运行脚本
./test.cgi
我没有错误
Content-type: text/html
<html><body>hello scritp</body></html>
在此问题之前有人遇到过吗?以及解决方案? :) 干杯
【问题讨论】: