[PLUG] python as a cgi in Apache

Josh Orchard josh at emediatedesigns.com
Thu Sep 12 15:58:44 UTC 2002


Try that also.  the \n do present new line returns.  That was one of the
issues with the bug from Apache I read.  Something about after the headers
there needs to be a new line.
The script runs fine from a command line.  It returns output that looks fine.


Josh

> On Thu, 12 Sep 2002, Josh Orchard wrote:
>
>> I then try to execute a simple python script: (~josh/cgi-bin/test.py)
>> #!/usr/bin/python2
>>
>> print '''
>> Content-Type: text/html\n\n
>> <html>
>> <head>
>> <title>Hello there </title>
>> </head>
>>
>> <body>
>>
>>     Hello
>> </body>
>> </html>
>> '''
>>
>>
>> I get server 500 errors and the logs show:
>>
>> Premature end of script headers:
>> /home/josh/public_html/cgi-bin/test.py
>
> I don't know much python, so I may be way off the mark -- but my hunch
> is that your script is a literal '\n\n' string, not two newlines, in
> your Content-Type description. Try this:
>
>  print '''
>  Content-Type: text/html
>
>  <html>
>  ...
>  </html>
>  '''
>
> --Paul Heinlein <heinlein at attbi.com>
>
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug







More information about the PLUG mailing list