Re: [Hampshire] Apache config & cgi-bin

Top Page

Reply to this message
Author: Dr Adam J Trickett
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Apache config & cgi-bin
On Tue, 22 May 2007 at 11:32:06AM +0100, Hugo Mills wrote:
> On Tue, May 22, 2007 at 10:03:42AM +0100, Bond, Peter wrote:
> > > > Symptoms are "Premature end of script headers" in the error log.
> >
> > > Your problem is that the script is not returning a vaild hmtl
> > > page; this almost always means that the script had failed.
> >
> > It's almost too Mickey Mouse to fail:
> >
> > #!/bin/sh
> > echo "Content-type: text/html
>
>    I could be wrong, but shouldn't there be an empty line here? The
> "Content-type" header is a part of the HTTP response, and will be
> added to the HTTP headers. The <html> following is part of the
> document payload.


The error report almost always means that Apache recieved the header details
but no body. As Hugo pinted out there must be a gap between the header
and body. I believe that the RFC requies a carriage return and line
feed.

Visually you see:

header stuff

body stuff

Without the gap Apache will complain with the above error.

A mangeled header from the duff echo will do the same, but it's
the same symptom Apache expects header lines a gap then
the body. If it doesn't look like that it will complain.

--
Adam Trickett
Overton, HANTS, UK

A people that values its privileges above
its principles soon loses both.
    -- Dwight D. Eisenhower