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?
- The White Screen of Death of Error 500
- 500 Internal Server Error Causes
- How To Fix The 500 Internal Error
- All HTTP Status Codes
What Is The 500 Internal Server Error?
It is considered a general error on the server side due to a non-specified problem. From the RFC Standards, we have this definition:
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfillingRFC 7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content (rfc-editor.org)
It is not an error in your connection or browser. Rather, it means something has gone wrong with the website.
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:
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”
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:
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-fpmis misconfigured or your current version has a bug.
How To Fix The 500 Internal Error
As mentioned in the previous section, the causes of the 500 error can be diverse and not always apparent 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.
To enable the logs here you have two options: the first one for generic PHP applications and the second one for sites running WordPress.
How to show and log errors in plain PHP applications
- Enable error reporting: add the following line to the beginning of your PHP script:
- Display errors by adding this
- And log error setting these two options:
Additonally, you can also set these directives in the PHP configuration file
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 th wp-config.php file to show PHP errors with WordPress.This will enable debug mode in WordPress and display all PHP Errors, Warnings, and Notices on the screen.
- Locate the
wp-config.phpfile: This file is in the root directory of your WordPress installation.
- Open the
wp-config.phpfile: You can open this file using a text editor such as Notepad, TextEdit, or Sublime Text.
- Add the WP_DEBUG constant to display the errors:
- And or enable the debug logging to the /wp-content/debug.log with this next constant:
define( 'WP_DEBUG_LOG', true );
- 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 look at the right place
500 internal server error occur in PHP, it is considered 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
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
208 Already Reported
226 IM Used
300 Multiple Choices
301 Moved Permanently
303 See Other
304 Not Modified
305 Use Proxy
307 Temporary Redirect
308 Permanent Redirect
402 Payment Required
404 Not Found
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
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
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
501 Not Implemented
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.