Canned CGI problems

Ben Pfaff pfaffben@msu.edu
06 Jun 2001 10:05:04 -0400


Mike Szumlinski <szumlins@msu.edu> writes:

> I have tried a couple of canned cgi programs, some work, but the ones that
> don't spit this out into /var/log/httpd-error.log
> 
> [Wed Jun  6 00:48:55 2001] [error] (2)No such file or directory: exec of
> /usr/local/www/cgi-bin/cstrike/YaBB.pl failed
> [Wed Jun  6 00:48:55 2001] [error] [client 192.168.3.77] Premature end of
> script headers: /usr/local/www/cgi-bin/cstrike/YaBB.pl
> 
> I have no clue what "Premature end of script headers" means. Any ideas?

CGI programs are expected to do two things: spit out a set of
HTTP headers followed by a blank line, then spit out a webpage if
appropriate.  This message means that the CGI program failed to
do the first of those.

Here's a CGI implemented in Bourne shell:

#! /bin/sh
echo 'Content-Type: text/html'
echo
echo '<HTML>Here's some non-DTD compliant HTML.</HTML>'

If you leave off the second and third `echo' lines, you'll get
that error.
-- 
"Unix... is not so much a product
 as it is a painstakingly compiled oral history
 of the hacker subculture."
--Neal Stephenson