We moved one of our small websites to a new server a week or so ago, everything seemed hunky-dory at the time, I go away for a week and come back to find that "nothing's changed but none of our CGI scripts work any more" *sigh*.
What we're getting is that loveliest of apache error messages "premature end of script headers" for our perl CGI scripts, I'm running out of things to try, and I'm pretty sure I've covered everything that searching PM turned up that was relevant.
What we have is this:
A trivial test cgi script:
(cgi_test)% cat test.cgi #!/WWW/bin/perl -wT $|=1; print "Content-type: text/html\n\n"; print "hello\n";
which, when called through a browser, errors, leaving the following in the logs:
Error handling is done via bourne shell cgi scripts (in order to produce more user friendly error messages, etc), which work fine:in http.log: whars0ck.europe.nortel.com - 0502164 [18/May/2004:10:04:28 +0100] "GET + /~callum/cgi_test/test.cgi HTTP/1.1" 500 403 in http-error.log: [Tue May 18 10:04:28 2004] [error] [client 47.165.6.42] Premature end +of script headers: /u/callum/public_html/cgi_test/test.cgi
Is giving the "500:Server configuration error, whinge to Callum" message that I'd expect it to, and changing the name of the person to complain to dosn't appear to fix the problem :)ErrorDocument 403 /admin/error/403.cgi
The test script works fine on the command line of the webserver:
(logs)% /u/callum/public_html/cgi_test/test.cgi Content-type: text/html hello (logs)%
The http error code 403 Forbidden usually means a permissions problem, but I don't believe that's the case here: the permissions on /WWW/bin/perl are 555, the permissions on test.cgi are 755, everyone has read and execute permissions (ie, ugo+rx) to all directories up to and including cgi_test/
The webserver and the workstation where I'm editing stuff and running the browser are both Unix boxes, and the editing's being done in vi -- so no CRLFs or such nonsense.
The script is being recognised as CGI, in particular the webserver is returning an error code 500, but it dosn't appear to execute it -- change the script so the first thing it does is touch a file in /tmp, works fine on the command line, no result through the browser other than the same errors. There is a handler set up for cgi scripts:
And as mentioned earlier the bourne shell error handling scripts are working fine.AddHandler cgi-script .cgi .sh
I think I've included everything I've looked at -- does anyone have any suggestions as to what might be going wrong?
In reply to Apache/CGI error: "Premature end of script headers" by Callum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |