Knowledge base/Downloadable version

I got "Internal server error" message (UNIX/LINUX)

Technical Support
posted this on January 19, 2009 16:51

When running a Perl CGI script, you may see the "Internal Server Error" message in your browser.  The message will usually also say something like "please check the server's error-log for more information."  You should do that -- the message printed to the error log will often tell you exactly what the problem is.  The Apache error log, for example, is often located at /var/log/apache/error_log or /var/log/apache2/error_log (or sometimes "error.log").

Before you check your webserver configuration please try TouristWay CGI configuration diagnostic script by calling:

http://www.yoursite.com/twpub/cgitest.cgi

 

Try to access the page from your browser.  If it works (you see "Touristway CGI test on /www.yoursite.com/twpub/ successful!" as its output) then you know that your server is at least configured properly for running Perl CGI scripts.  If it doesn't work, then that may mean the problem is in the server configuration, rather than with your CGI script.  

Assuming your server is configured properly for running CGI scripts, your problem may be one of these common causes for the Internal Server Error:

Check your server configuration:

  1. Directory permissions: your cgi-bin directory should be chmodded as 0755, not 0777.  Similarly if your script is at .../cgi-bin/foo/bar.cgi, the foo directory must not be world-writable (0777).  This is because many servers will refuse to execute CGI scripts within world-writable directories, as a security precaution.
  2. File permissions: your CGI script itself must also be 0755 and not 0777, for the same reasons.
  3. When running a Perl CGI script, you may see the "premature end of script headers" error in your Apache error.log or error_log file.  This can be caused by some particularly tricky cause to track down: suEXEC problems:

    Check if you have a /var/log/apache/suexec.log file; if so, and if it's the problem, it'll explain the reason why it's denying your script from executing properly.  Usually it's about file ownership mismatch, in this case an easy fix is to make sure that your CGI script has the same user/group ownership as your cgi-bin folder.

 
Topic is closed for comments