Cgi scripts in apache not working

David Neruocomp at yahoo.com
Thu Jul 28 13:27:59 EDT 2005


I've looked all over the place for an answer, and the only one I can
find doesn't mean anything to me. The end of line issue with writting
it in Windows and then uploading it doesn't help me since I'm doing
this all from Linux. I've been trying to get python cgi scripts to
work, and I always end up with a "Premature end of script headers" in
the error log.

The scripts are executable by all and my httpd.conf seems fine. I also
tested it out in /var/www/cgi-bin/ and there it seems to work fine.

test2.py:

#!/usr/bin/python
print "Content-type: text/html\n\n"
print """<html>
<head></head>
<body>
<h1>Hello World</h1>
</body>
</html>"""

httpd.conf:

<Directory "/home/*/public_html/cgi/"> << Tried it with "" and no ""
        Options ExecCGI << Tried with "Options +ExecCGI"
        AddHandler cgi-script .cgi .py << Tried with "SetHandler
cgi-script", but still no go
</Directory>

error_log:

[Thu Jul 28 11:44:53 2005] [error] [client xxx.xxx.xxx.xxx] Premature
end of script headers: test2.py

suexec.log:

[2005-07-28 11:44:53]: uid: (500/davidnoriega) gid: (500/500) cmd:
test2.py
[2005-07-28 11:44:53]: directory is writable by others:
(/home/davidnoriega/public_html/cgi)




More information about the Python-list mailing list