【发布时间】:2013-01-12 14:52:08
【问题描述】:
我正在尝试在我的 sourceforge 存储库中托管示例程序 test.py。我从目录/home/project-web/motiur/cgi-bin/ 上传了我的文件,然后转到motiur.sourceforge.net/cgi-bin/test.py。不幸的是,我收到一个错误,提示标题过早结束。
test.py的源码:
#!/usr/local/bin/python
import cgi, cgitb
print "Content-type:text/html\n"
print "<html><body>This is another test</body></html>"
确切的错误是:
An error has been encountered in accessing this page.
1. Server: motiur.sourceforge.net
2. URL path: /cgi-bin/test.py
3. Error notes: Premature end of script headers: test.py
4. Error type: 500
5. Request method: GET
6. Request query string:
7. Time: 2013-01-12 14:49:39 UTC (1358002179)
顺便说一句,我在windows中使用filezilla并将文件权限设置为755,即每个人都可以执行该文件。这是一个菜鸟问题,将不胜感激。谢谢。
【问题讨论】:
-
@YannisRizos:错误是;访问此页面时遇到错误。 1. 服务器:motiur.sourceforge.net 2. URL 路径:/cgi-bin/test.py 3. 错误说明:脚本头提前结束:test.py 4. 错误类型:500 5. 请求方法:GET 6.请求查询字符串:7。时间:2013-01-12 14:49:39 UTC (1358002179)
-
@YannisRizos:有什么建议吗?
-
看文章Premature end of script headers。我注意到不同的一件事是它们在
print "Content-type:text/html\n\n"的末尾有一个额外的换行符。 -
@martineau:对不起,问题仍然存在,即使在您更改之后。
标签: python cgi sourceforge