首页 > 技术文章 > [Python]python CGI脚本在apache服务器上运行时出现“Premature end of script headers”错误

KarryWang 2013-09-22 08:33 原文

  在测试自己的python CGI脚本时, 当html网页中的表单form内容传送到服务器python脚本时, 总是出现Premature end of script headers错误, 网页显示是服务器端的内部错误。

  Internal Server Error

  The server encountered an internal error or misconfiguration and was unable to complete your request.

  Please contact the server administrator, webmaster@localhost 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.

  从之前我遇到的一些类似情况看, 我大约知道这肯定又是脚本哪里出错了, 但是修改了脚本的每个地方依然还是出错, 最后在网上搜索相关文章的时候, 忽然看到#!/usr/bin/python, 就萌生了去检查一下自己的这句话是不是写错了, 当我真正看到我自己的那条语句的时候, 我的小伙伴们也惊呆了, " #/usr/bin/python "   holy shit, 居然少了一个#号。 如果你遇到类似的问题, 可以去看看是否是因为马虎漏掉了什么。。

  

推荐阅读