Help: Apache: cgi script - malformed header from script

Help: Apache: cgi script - malformed header from script

Post by Alistai » Fri, 24 Sep 1999 04:00:00



Trying to get simple cgi to work...

I've written a simple shell script to output some basic html, but when I run
it I get this error message in the error log:

  malformed header from script. Bad header=<HTML>

I've looked in the FAQ and it's helpful in the sense that it states:
"the server was expecting a complete set of HTTP headers (one or more followed
by a blank line), and didn't get them."

Unfortunately, I don't know what an http header is or looks like, and the
Apache documentation isn't helpful in this respect. My shell script simply
wrties to stdout:

<html>
<title> a title </title>
<body>
some text
</body>
</html>

Also...

I've added a "ScriptLog logs/cgi_log" entry to the httpd.conf file, but there's
no output there (yes I've restarted the server). I've even touched the file so
that it exists (with the same permissions as the other log files) but no joy.


crashes when I open this newsgroup.

Alistair.

 
 
 

Help: Apache: cgi script - malformed header from script

Post by Kevin J. Dy » Fri, 24 Sep 1999 04:00:00




Quote:>Trying to get simple cgi to work...

>I've written a simple shell script to output some basic html, but when I run
>it I get this error message in the error log:

>  malformed header from script. Bad header=<HTML>

>I've looked in the FAQ and it's helpful in the sense that it states:
>"the server was expecting a complete set of HTTP headers (one or more followed
>by a blank line), and didn't get them."

>Unfortunately, I don't know what an http header is or looks like, and the
>Apache documentation isn't helpful in this respect. My shell script simply
>wrties to stdout:

Your script is missing a Content-Type:
You need to add at least one line that outputs.

echo "Content-Type: text/html\n\n"

><html>
><title> a title </title>
><body>
>some text
></body>
></html>

>Also...

>I've added a "ScriptLog logs/cgi_log" entry to the httpd.conf file, but there's
>no output there (yes I've restarted the server). I've even touched the file so
>that it exists (with the same permissions as the other log files) but no joy.


>crashes when I open this newsgroup.

>Alistair.