/var/log/httpd/error_log
malformed header from script. Bad header=<html>
ref: http://cs.uccs.edu/~cs301/perl/perl.htm
Basically the web server complains that the wrongHello.cgi returns a web page without proper header such as “content-type: text/html ” before the body of the web page <html>HelloWorld!. The header is required as the CGI secification or CGI protocol between the CGI process running the wrongHello.cgi and that of the web server. For more detail see the CGI web page.
The above hello.pl is perl script can be run standalone. It is not a CGI perl script since it did not follow the CGI protocol. In order to make that as a CGI perl script, we need to add the following two lines after #!/usr/bin/perl
use CGI qw(:standard);
print header();or
print “content-type: text/html “;
Try http://sanluis.uccs.edu/~cs301/cgi-bin/hello.cgi or http://sanluis.uccs.edu/~cs301/cgi-bin/hello2.cgi, src, which implement the above fixes.
看到這錯誤訊息時,在 print “<html> “; 前加上 use CGI qw(:standard); print header(); 即可解決
留言