using python as cgi on apache unix
gerhard.haering at gmx.de
Tue Sep 17 02:46:48 EDT 2002
* josh_py at sautez.com <josh_py at sautez.com> [2002-09-16 22:48 -0700]:
> 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:
> print "\n\n"
> print "Content-Type: text/html\n\n"
> print "hello"
The first print "\n\n" is an error. It was simply luck that this was
running anywhere else as expected. Just delete this line and your hello
world cgi script should run fine.
Also, to test wether Python CGI scripts work, you can always simply use:
#! [path to python ...]
More information about the Python-list