Cgi scripts in apache not working



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)

.



Relevant Pages

  • Re: Python cx_Oracle and Apache
    ... on the browser i get the famouse "Premature end of script headers" ... Look at the server's error log to see what the real error message is. ...
    (comp.lang.python)
  • Re: CentOS 5.0 Apache installation
    ... configuration Apache to talke with cgi-script, ... the default setting for the cgi-script, ... directory for the cgi-script it display errors when I try to visit the ... premature and of script headers ...
    (comp.os.linux.misc)