I was trying to just test a simple Perl/CGI script and I always seem to get this error even after I've tried chmod 775 and chmod 777.
This is my HTML...
<html><head><title>Post.html</title></head>
<body>
<form action="/cgi-bin/post.cgi" method="POST">
<pre>
Your Name: <input type="text" name="name">
Email Address: <input type="text" name="email">
Age: <input type="text" name="age">
Favorite Color: <input type="text" name="favorite_color">
</pre>
<input type="submit" value="Send">
<input type="reset" value="Clear Form">
</form>
</body>
</html>
My Perl/CGI script...
#!/usr/bin/perl
print "Content-type:text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
print "<html><head><title>Form Output</title></head><body>";
print "<h2>Results from FORM post</h2>\n";
foreach $key (keys(%FORM)) {
print "$key = $FORM{$key}<br>";
}
print "</body></html>";
The Error message I get...
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: post.cgi
If you think this is a server error, please contact the webmaster
Error 500
xxandyxx.cjb.net
Sun 06 Jul 2003 08:18:16 AM EDT
Apache/2.0.40 (Red Hat Linux)
http://XxAndyxX.cjb.net/post.html