500 Internal Server Error - How to troubleshoot and fix it?

| | 2 min read

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

internal server .png

Every website owner or developer comes across the Internal Server Error aka Error 500 at least one time in the lifespan of the website, irrespective of whether the website is implemented in Drupal or not.

HTTP/1.1 500 Internal Server Error

Did you get the same error now?

If yes, let us find out how to fix this issue. The internal Server Error message is a generic error response returned by the server when no other error code is suitable. This means something happened unexpectedly and the server could not process the request. In my case, the last time I got this error was when MySQL got time out in executing a large query in a high-traffic scenario.

There are lots of reasons behind a 500 Error. However, the most common causes are:

  • Permissions Errors: An incorrect permission on one or more files or folders.
  • Timeout Issues: If your script connects to external resources timeout.
  • A missing or erroneous .htaccess file

How to fix 500 Internal Server Error on your site?

Let us find out the actual reason behind the internal server error. In most cases, the error gets logged in the webserver's error log with some details.

If you are using the Apache web server, the common location to find the log is

/var/log/apache2/error.log

But based on your configuration, this location can change. If you can find the error logged, it will give you a clue.

From the error messages, we can identify whether an internal server error occurred due to incorrect permission or a Timeout or the 500 server error was caused due to a missing/erroneous .htaccess file.