Handling 500 Internal Server Error

What usually caused this?

It means that the web server facing ‘internal‘ error before the output can be deliver to client. Basically something has gone wrong, but the server can not be more specific about the error condition. Since web server can be integrated with so many modules inside, this may cause by one of the module facing error when web server received the data from them.


Can you give me some example?

  • An error in a CGI script that caused it to fail or output an error message before it started producing valid HTML. It usually happens if you have a syntax error in one of Perl/PHP CGI scripts.
  • A permissions issue attempting to access a CGI script. Depending on how your web server is configured, quite often it’s not enough for the script to have “execute” permission, but it must also be owned by the correct user, and belong to the correct group.
  • Invalid custom configuration files like .htaccess, web.config, version  incompatibility or wrong syntax applied

What you need to check?

1. Analyse the Apache error logs. Using text editor like vi, nano, ee, pico or anything that convenience to you. You also can use output display like cat, more or tail command to analyse the log. One of the best way is using tail -f command like below and hit the respective error page in real-time:


tail -f /usr/local/apache/logs/error_log


tail -f /var/log/apache2/error.log

2. Make sure you verify the files/directory ownership and permission is in correct place. Understanding the handler type (CGI, FastCGI) might help you a lot in this.

3. Make sure the simple code can run without problem. For example, PHP can open phpinfo() page or Perl can deliver simple version output.

4. If you have no direct access to the web server, you can contact the server administrator and tell them about this error. Don’t forget to provide required information like time stamp when it happen, how to reproduce the error and when it started to happen.

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *