Liuw's Thinkpad

想要赢就先学会输,想要成功就先学会失败

Archive for the ‘apache’ tag

解决一个Python CGI的小问题

without comments

写了一个Python CGI给Apache,但是运行的时候却是500 Internal Server Error。

查了一下errorlog,打印的错误信息是“Premature end of script headers”,google一把,发现类似的问题还真不少。原因就是Apache在等待脚本的输出,但是脚本没有输入。

但是我的脚本其实是有输出语句的。看来问题可能是在IO buffer那里了。

使用 -u 参数运行,问题解决。

Written by liuw

October 14th, 2009 at 8:27 pm

Posted in UNIX-like

Tagged with , ,