Internal Server Error Resolution

What is a HTTP 500 Internal Server Error?

When a webserver returns a 500 status code, it means there is something wrong on the website. So the user requested a proper page, but something on the server makes it unable to fulfill that request. The user has no way to resolve this except wait for it to go away. These errors are the responsibility of the website owner to handle and prevent.

You can check out the details on wikipedia or in the official RFC.

What causes Internal Server Errors?

There are two main causes: human error and unavailable services.

Human error is usually a programming mistake or configuration error. Usually this happens if someone makes a quick fix on the server, without testing it first on a test environment or when a file that isn\’t supposed to is deployed to your production environment. These are things that should never happen, but still they do and you want to know about it immediately.

Common errors:

  • Typing errors in .htaccess files
  • Syntax errors in PHP / Python / Ruby / Perl code
  • Wrong configuration file (e.g. a development one)
  • Unhandled edge cases, e.g. when there is no matching record in the database

The other main cause for HTTP 500 response or Internal Server Errors is an error on a service you depend on. For most websites this is a database server or an external API.