Apache处理header信息错误

Apache处理header信息错误

程序执行后页面显示“Internal Server Error”这样的错误信息。
我查看apache的错误日志里面记录的是
malformed header from script. Bad header=\x1f\x8b\b: /var/eyou/apache/cgi-bin/admin/rmuser

rmuser这个程序在别的服务器上执行都没有任何问题。请问是apache服务器的配置问题,还是程序的问题?
这年头还有用 C CGI的么
Object Headers


What does the "malformed header from script" error mean, and how can I
get rid of it?


This is the most frequent error new CGI programmers encounter.
It usually arises when the programmer writes a script that
returns some HTML when called -- in other words, a script that
generates a Web page on the fly.


"Header" refers to the HTTP object header lines in a server's
response to a client's request. The server sends several lines
of "metainformation" describing the content that will follow, a
blank line, and then the requested object. As with news and
mail, the header and the body are always separated by a blank
line.


CGI scripts that wish to return information to clients are
required to:

1. send a header line, Content-type:, describing with a MIME
Content-type the object that will follow (for instance, if
the script wanted to return HTML, this header would read,
"Content-type: text/html");
2. a blank line; and
3. the desired content.



A Perl script that generated HTML, then, would use the
following line to declare its Content-type:

print "Content-type: text/html\n\n";


The Content-type declaration must always be the first line sent
to standard output, if the script intends to return any
information to the client.
A Perl script that generated HTML, then, would use the
following line to declare its Content-type:

print "Content-type: text/html\n\n";

在#! /usr/bin/perl行下
加上print "Content-type: text/html\n\n";