using python as cgi on apache unix

josh_py at sautez.com josh_py at sautez.com
Tue Sep 17 01:48:39 EDT 2002


All,

I have developed a python solution to run and connect to a mysql database.
I did all my development under windows apache 1.3.26 and python 2.2.1.  I
know want to move this to my unix server.  Unfortunately, no matter what I
do I can not get apache on my linux box to execute any python scripts.  I
get the following errors in apache:

Premature end of script headers: /var/www/html/cgi-bin/test.py

I have all the settings in apache I believe to be correct.  It complains
that the file is not executible if that is not set.  Other CGI works fine.

test.py looks like:

#!/usr/bin/python2

print "\n\n"
print "Content-Type: text/html\n\n"
print "hello"


I have read Apache's notes on the error and they mention I have the wrong
headers.  But other sample scripts say I have it correct.  Again, I do have
this working on windows fine.  The apache i have on my RH 7.0 box is 1.3.22.
Python is 2.2.1.   If you have any suggestions as to how I may get this to
work I would appreciate it.  I don't have a need for mod_python as my script
is really small and well have little traffic.  Thanks for any help.  I may
have to go rewrite the script in PHP soon if I don't get this resolved.  I'm
stump.

Josh





More information about the Python-list mailing list