[plug] Apache problem

John Summerfield summer at os2.ami.com.au
Sun Jan 2 11:10:50 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.

John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.

More information about the plug mailing list