Re: Cgi scripts in apache not working
- From: Bruno Desthuilliers <bdesth.quelquechose@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Jul 2005 01:45:33 +0200
David a écrit :
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
Is it executable by yourself ?
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 ""
shoud be without "" AFAIK (well, it's without on all our servers !-)
Options ExecCGI << Tried with "Options +ExecCGI"
AddHandler cgi-script .cgi .py << Tried with "SetHandler cgi-script", but still no go
<ot> SetHandler tells apache to treat everything as a cgi , whatever the .xxx </ot>
I've tried your script (renamed py.cgi, because .py is not in my default apache conf and I wanted to try it out of the box), with the following conf for userdirs:
<Directory /home/*/public_html/cgi-bin>
Options +ExecCGI -Includes -Indexes
SetHandler cgi-script
</Directory>runs fine.
I've then added a .htaccess in my ~/public_html: Options +ExecCGI AddHandler cgi-script .cgi
And mv'd py.cgi from ~/public_html/cgi-bin to ~/public_html.
runs fine.
error_log:
[Thu Jul 28 11:44:53 2005] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: test2.py
What are the previous and next lines ? I've found such a line in my error_log, due to me forgetting to make the script executable, and there was a
[Fri Jul 29 01:14:33 2005] [error] [client 127.0.0.1] (13)Permission denied: exec of '/home/bruno/public_html/cgi-bin/py.cgi' failed
before.
Then I tried chmod u-x py.cgi, and got the same error message as you did, but this time with no "Permission denied" before.
Aayway, I think your problem is with permissions and/or your apache conf, so you may find more useful help on an apache ng.
My 2 cents .
- References:
- Cgi scripts in apache not working
- From: David
- Cgi scripts in apache not working
- Prev by Date: Python fails compiling in socket extension
- Next by Date: monitor a folder for file creation, how?
- Previous by thread: Re: Cgi scripts in apache not working
- Next by thread: Adding code and methods to a class dynamically
- Index(es):
Relevant Pages
|