using python as cgi on apache unix

josh_py at josh_py at
Tue Sep 17 13:15:19 EDT 2002

"Dennis Reinhardt" <DennisR at> wrote in message
news:orHh9.167$UJ1.17889587 at
> > ... want to move this to my unix server.  Unfortunately, no matter what
> > do I can not get apache on my linux box to execute any python scripts.
> > get the following errors in apache:
> > Premature end of script headers: /var/www/html/cgi-bin/
> What do you get when you type "" at the shell prompt when logged
> the cgi directory on the RH box at the command line?  Do you get:
> ---
> ---
> Content-Type: text/html
> ---
> hello
> where "---" is taken as a blank line?  I agree with Gerhard that the
> print "\n\n" is wrong.  But your comment trying the cgi.test suggests that
> something else is going on.  The above test may sniff out that something
> else.
> Dennis Reinhardt

I do get the correct results.  I also removed the blank lines and it still
didnt' work.

I have now moved the script to yet another machine and now it works.  I must
have Apache configured in such a way on the one machine that it is confused.
It knows the .py are executible and such but does not execute them
correctly.  There is a problem with how apache is seeing the file and
executing the program.  I will have to review the httpd.conf file in both
cases to try to figure it out.

Thanks for the suggestion and pointing out my errors with the print


More information about the Python-list mailing list