What is a 500 Internal Server Error

Posted 

3 min read

One of the most common errors that occur when browsing the web is the “500 Internal Server Error”. This message indicates that the webserver is experiencing technical problems.

This article explains what a 500 error means, why you’re getting an HTTP 500 code, and how to troubleshoot these errors.

What is a HTTP 500 Error

Each time you open a web page, your browser sends a request to the server hosting the site, which returns the requested data and response code. The HTTP response status codes indicate whether the request has been successful or not.

Responses are categorized in five classes. The codes in the 500 to 599 range are indicating a server error.

The HTTP status code 500 is a generic error response that is returned by the server when no other error code is appropriate. It can be caused by a number of problems that prevent the server from completing the request.

If the page you are visiting throws 500 Error there is nothing much you can do since the error is not caused by your browser or Internet connection. Even though the error is on the server-side, you can try some of the following options:

  • Reload your browser or try with another one. The chances that the page will load when you refresh your browser are low, but still, it’s worth giving it a try.
  • Try to clear your browser cache. If the page that shows 500 error is cached, after the cache is cleared, the browser will request a new version of the page.
  • Come back later. The webmaster may fix the server issue in the meantime.
  • Contact the website owners. The last remaining option is to get in touch with the person responsible for maintaining the website.

Troubleshooting 500 Error

A number of different reasons could cause the 500 Internal Server Error. Here are the most common ones:

  • A permission issue. When the webserver has no permissions to access the site files, it may throw an HTTP 500 error. The solution to this issue is to change the website file’s permissions recursively .
  • .htaccess syntax error. If you are using Apache as a webserver, then most probably you have a .htaccess file in your site root directory. Invalid syntax or non-existing module directive can lead to a 500 error.
  • Database related issue. HTTP Error 500 can also be caused by incorrect database server information or a corrupted database.
  • Issues with plugins and themes. If you are running WordPress or similar CMS, the 500 error can appear after updating or modifying a plugin/theme.
  • Server issues. A corrupted filesystem or exhausted memory can lead to 500 error.
  • Node.js modules. If you have Node.js based site, updating modules can cause a 500 internal server error.
  • Hacked site. Quite often a malicious code that is injected into your website results with a 500 error.
  • Incompatible module. Loading an incompatible PHP or Apache module throws the 500 error.
  • External Resource Timeout. If the server communicates with external service and if those services are not reachable the server will show a 500 error message.

The best way to determine why the 500 error occurred is to check the server log files. The location od the log files depends on your Linux distribution and the web server. The most common locations for Apache and Nginx are as follows:

/var/log/apache2/error.log
/var/log/httpd/error_log
/var/log/nginx/error_log

If your application is built on Node.js, check the Node.js logs.

Typically the server log contain a detailed information about the error that will help you to identify and fix the error.

Conclusion

The 500 Internal Server Error is a general HTTP status code meaning that something went wrong with the web server hosting the site you’re visiting.

If you have any questions or feedback, feel free to leave a comment.