using python as cgi on apache unix

josh_py at sautez.com josh_py at sautez.com
Tue Sep 17 13:15:19 EDT 2002


"Dennis Reinhardt" <DennisR at dair.com> wrote in message
news:orHh9.167$UJ1.17889587 at newssvr14.news.prodigy.com...
> > ... 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
>
> What do you get when you type "test.py" at the shell prompt when logged
into
> 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
initial
> 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
>
> http://www.dair.com
>
>

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
statements.

Josh





More information about the Python-list mailing list