[plug] Apache problem

Paul Wilson hooker at opera.iinet.net.au
Sun Jan 2 12:34:29 WST 2000


> > > > I've got a problem with a CGI program written in C and running under
> > Apache
> > > > 1.3.6 and RedHat 6.0.  I've asked for advice over on the Apache
mailing
> > list
> > > > and the relevant Usenet group but met a resounding silence (probably
> > > > Christmas-induced!), so I thought I'd stray a little from the topic
here
> > and
> > > > ask the collective expertise of plug.
> > > >
> > > > When run from the command line, it works as expected, producing the
> > > > 'Content-type: text/html' header followed by a chunk of HTML.  When
> > called
> > > > via the CGI mechanism, I consistantly get Error 500 (Premature end
of
> > script
> > > > headers) from Apache.  A trivial C program to output the mime-header
> > > > followed by a tiny piece of HTML works properly, but this thing
refuses.
> > >
> > > Did you check the error log for your virtual host? STDERR from scripts
is
> > > written there.
> >
> > I did, and there's nothing but the error itself.
>
> Most likely, the program's terminating before it completes its task. I was
> expecting you'd find a SEGV or similar.
>
> You can write progress messages to STDERR and find them in the apache log;
> "tail -f" is good for this.
>
> You can also get working a skeleton that works, then build up from there,
> adding and running. Or, from what you have, cut (by commenting or #ifdef
> ), compiling & running.
>
> Cut big bits at first. One you've cut the broken bit, add smaller bits
> back, compile & run.
>
> I've just perused a program I have that works, and there's nothing obvious
> to me you might have forgotten.

I know you're right John -- I was just trying to be lazy and avoid it.
<sigh>

There isn't a core file in the virtual host directory, and when run from the
command line the program runs to completion (that is, "when run from the
command line using a suitably constructed shell script to pass parameters"
it runs OK).  I agree about the progress messages and am doing this
more-or-less now.

BTW, the message 'Premature end of script headers' -- does that also imply
that the HTML may not be complete?  I'd been assuming that the mime header
was somehow wrong.  Maybe I been too blinkered !!

Paul



More information about the plug mailing list