HTTP 500 Internal Server Error: Causes And Fixes

Error 500 Internal Server Error

Last update:

The HTTP Internal Server Error 500 typically occurs when the server encounters an unexpected condition that prevents it from fulfilling the request. This post will help you understand the causes of the error and find appropriate solutions.

Table of Contents

What Is The 500 Internal Server Error?

It is considered a general error on the server side due to a non-specified problem. According to the RFC Standards, the definition is as follows:

The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling
the request.

RFC 7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content (rfc-editor.org)

This is not an error in your connection or browser; rather, it indicates an issue on the website’s end.

Generic Error 500  screen in Chrome browser
Generic Error 500 in Chrome browser

The White Screen of Death of Error 500

The “White Screen of Death” (WSOD) is a term used to describe the 500 HTTP error, and other 5XX HTTP error codes when the server cannot serve any content to the user. Some browsers like Safari or Firefox present this white screen:

White Screen Of Death in Firefox
Firefox does not show 500 error messages

Alternatively, you have browsers that translate the Internal 500 error, showing different informative messages.

Different 500 Error Messages

Although this error may appear in many ways, they all mean the same. The following displays a few examples of how you might see a 500 HTTP error.

  • “500 – Internal Server Error”
  • “500 Error”
  • “500 Internal Server Error. Sorry, something went wrong.”
  • “500 Internal Server Error”
  • “500. That’s an error. There was an error. Please try again later. That’s all we know.”
  • “HTTP 500 – Internal Server Error”
  • “HTTP 500”
  • “HTTP Error 500”
  • “Internal Server Error”
  • “This page isn’t working at the moment. HTTP ERROR 500.”
  • “This page isn’t working. – localhost is currently unable to handle this request. – HTTP ERROR 500”
Generic Error 500 shown in Edge browser
Generic Error 500 shown in Edge browser

When the option to display errors to the user is enabled, and the execution is not interrupted, the server can provide more comprehensive information about errors than when the user encounters a WSOD (White Screen Of Death).

In such cases, the server may display crucial details related to the error, like the file and line number where the error occurred, a description of the error, and sometimes a stack trace.

The following screenshot shows an example of this, detailing a 500 internal server error on a WordPress page:

Details of a 500 internal server error on a WordPress page

In the following section, you will come across various scenarios that can lead to the occurrence of the 500 error.

500 Internal Server Error Causes

  • A Database error while trying to retrieve data. E.g a corrupted Database, or a wrong SQL syntax.
  • The application throws an error, such as a runtime error, e.g. an insufficient PHP memory, or a PHP execution timeout.
  • There is an error in the application code. For instance, PHP is trying to include a nonexisting file, or a division by zero is interrupting the execution.
  • Your server hardware could have a problem. For instance, you have corrupted files due to a disk failure.
  • There is a server software problem. For instance, php-fpm is misconfigured or your current version has a bug.

How To Fix The 500 Internal Error

As previously mentioned, the reasons for a 500 error are varied and might not be immediately obvious in the browser.

To solve it, check the error logs or print them in the browser for further diagnosis.

When it comes to 500 Internal Server Errors,
there’s no one-size-fits-all solution.

Checking error logs can help identify the root cause.

How To Get More Details About The Errors In PHP

The answer is simple: display the errors or inspect the logs. The latter option is preferable, as a 500 internal server error can sometimes cause the execution to break, resulting in nothing but a WSOD (White Screen Of Death).

Hey, just a heads up!

If you have a WordPress website hosted on a Wetopi server,
you can easily access your logs with
just a click of your mouse.

show logs

To enable logs, you have two options: one for generic PHP applications, and another for WordPress sites.

How to show and log errors in plain PHP applications

  1. Enable error reporting: add the following line to the beginning of your PHP script:

    error_reporting(E_ALL);
  2. Display errors by adding this

    ini_set('display_errors', 1);
  3. And log error setting these two options:

    ini_set('log_errors', 'On');
    ini_set('error_log', '/path/to/php_errors.log');

Additonally, you can also set these directives in the PHP configuration file php.ini

error_reporting = E_ALL

display_errors = On

log_errors = On
error_log = /path/to/php_errors.log

How to show PHP errors in WordPress

You can use the WP_DEBUG constant in the wp-config.php file.This will enable debug mode in WordPress and display all PHP Errors, Warnings, and Notices on the screen.

  1. Locate the wp-config.php file: This file is in the root directory of your WordPress installation.
  2. Open the wp-config.php file: You can open this file using a text editor such as Notepad, TextEdit, or Sublime Text.
  3. Add the WP_DEBUG constant to display the errors:
    define('WP_DEBUG', true);
  4. Alternatively, enable the debug logging to the /wp-content/debug.log with this next constant:
    define( 'WP_DEBUG_LOG', true );
  5. Save the wp-config.php file.

You can get a more detailed explanation and refined configurations in the wordpress.org debugging documentation.

Microsoft Internet Information Services IIS shows 500 error details

If your web server is a Microsoft IIS; versions 7.0 and later have a subset of 500.XX HTTP error codes that indicate a more specific cause of error 500. This subcategory of 500 error codes will help you identify the cause of the error.

One final tip:

When inspecting logs, ensure you’re looking in the right place

When a 500 internal server error occurs in PHP, it is categorized as an ‘Error’ level message, rather than a ‘Warning’ or ‘Notice.Therefore, when examining logs or debugging screens for troubleshooting purposes, focus exclusively on Errors and skip Warning and Notice messages.

All HTTP Status Codes

200 OK

201 Created

202 Accepted

203 Non-Authoritative Information

204 No Content

205 Reset Content

206 Partial Content

207 Multi-Status

208 Already Reported

226 IM Used

300 Multiple Choices

301 Moved Permanently

302 Found

303 See Other

304 Not Modified

305 Use Proxy

307 Temporary Redirect

308 Permanent Redirect

400 Bad Request

401 Unauthorized

402 Payment Required

403 Forbidden

404 Not Found

405 Method Not Allowed

406 Not Acceptable

407 Proxy Authentication Required

408 Request Timeout

409 Conflict

410 Gone

411 Length Required

412 Precondition Failed

413 Payload Too Large

414 Request-URI Too Long

415 Unsupported Media Type

416 Requested Range Not Satisfiable

417 Expectation Failed

418 I’m A Teapot

421 Misdirected Request

422 Unprocessable Entity

423 Locked

424 Failed Dependency

426 Upgrade Required

428 Precondition Required

429 Too Many Requests

431 Request Header Fields Too Large

444 Connection Closed Without Response

451 Unavailable For Legal Reasons

499 Client Closed Request

500 Internal Server Error

501 Not Implemented

502 Bad Gateway

503 Service Unavailable

504 Gateway Timeout

505 HTTP Version Not Supported

506 Variant Also Negotiates

507 Insufficient Storage

508 Loop Detected

510 Not Extended

511 Network Authentication Required

599 Network Connect Timeout Error

We are techies passionate about WordPress. With wetopi, a Managed WordPress Hosting, we want to minimize the friction that every professional faces when working and hosting WordPress projects.

Not a wetopi user?

Free full performance servers for your development and test.
No credit card required.

See how Wetopi stacks up against your current hosting

Try before you buy.

With no obligation on your part, we’ll migrate a copy of your website:

No hidden small text.
No commitments.
No credit card.