[PLUG] python as a cgi in Apache

Brian Horan bhoran at hexdev.com
Thu Sep 12 16:26:07 UTC 2002


Sorry about that....that didn't help much....

a simple:
print "Content-Type: text/html\n\n"
should work fine...



Brian Horan wrote:
> 
> There is an easier way....
> http://www.python.org/doc/lib/node295.html
> 
> Josh Orchard wrote:
> >
> > 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
> >
> > _______________________________________________
> > PLUG mailing list
> > PLUG at lists.pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
> 
> --
> Brian Horan
> bhoran at hexdev.com
> 
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug

-- 
Brian Horan
bhoran at hexdev.com




More information about the PLUG mailing list