500

Internal Server Error

Official Substatus codes
An unspecified internal server error

General explanation of the 500 status code

The HTTP 500 Internal Server Error status code occurs when the server has a problem and is unable to process the user's request. This can have various reasons, such as technical problems, overloading of the server or problems with the software that runs the server.

Specification of the HTTP status code 500

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

Source / Quote by: The 500 Internal Server Error HTTP Status Code is specified by section 6.6.1 of RFC7231.

How to throw a 500 statuscode with PHP?

To throw the HTTP status code 500 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(500) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 500 HTTP status code

In order to be able to display the HTTP status code (in this case 500 Internal Server Error) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 500 Internal Server Error
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=500
Status: 500 Internal Server Error
Those: Network
IP address: XX.XX.XX.XX
Status code 500 Internal Server Error

How do I solve the problem with the 500 status code?

To fix HTTP Error 500 Internal Server Error, the first thing we need to do is find out why the HTTP 500 Internal Server Error status code was thrown in the first place. Reasons can be:

  1. Problems with server configuration or programming
  2. Errors in the ".htaccess" file
  3. Missing or corrupted files on the server
  4. Overloading the server or insufficient resources like CPU, RAM or bandwidth
  5. Difficulty connecting to other systems or databases
  6. Security issues such as DDoS attacks or malware infections
  7. Application or framework errors on the server

All of these things need to be checked, depending on which change was made last, this should be checked first. Since the causes for an HTTP 500 Internal Server Error status code can be so varied, no general recommendation can be made here.

.

How to create a custom error page for the 500 status code

Creating your own 500 Internal Server Error error page is relatively easy with the web server "Apache" as well as with the web server "NGINX".

Apache Webserver

The web server "Apache" is one of the most popular web servers on the Internet. To create an own 500 Internal Server Error error page in "Apache", the following change must be made in the following file.

File: .htaccess
ErrorDocument 500 /errors/500.html

NGINX Webserver

Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 500 Internal Server Error error page in "NGINX", the following change must be made in the following file.

File: sites-enabled/default
error_page 500 /500.html;
location = /500.html {
    root /usr/share/nginx/html;
    internal;
}

Browser compatibility of the 500 status code

Chrome no data
Edge no data
Firefox no data
Opera no data
Safari no data
Chrome Android no data
Firefox for Android no data
Opera Android no data
Safari on iOS no data
Internet no data
WebView Android no data

Constants in programming languages

HttpStatusCode.InternalServerError
http.StatusInternalServerError
Response::HTTP_INTERNAL_SERVER_ERROR
httplib.INTERNAL_SERVER_ERROR
http.client.INTERNAL_SERVER_ERROR
http.HTTPStatus.INTERNAL_SERVER_ERROR
:internal_server_error

Sub status codes of the 500 status code

Sub status codes are purely technical, and should never be sent to the user. For example, if status code 500.1 is thrown, it may be logged, but status code 500 will be sent to the user.:
500.0 Module or ISAPI error occurred
HTTP IIS, Unofficial
500.11 Application is shutting down on the web server
HTTP IIS, Unofficial
500.12 Application is busy restarting on the web server
HTTP IIS, Unofficial
500.13 Web server is too busy
HTTP IIS, Unofficial
500.15 Direct requests for Global.asax aren't allowed
HTTP IIS, Unofficial
500.19 Configuration data is invalid
HTTP IIS, Unofficial
500.21 Module not recognized
HTTP IIS, Unofficial
500.22 An ASP.NET httpModules configuration does not apply in Managed Pipeline mode.
HTTP IIS, Unofficial
500.23 An ASP.NET httpHandlers configuration does not apply in Managed Pipeline mode
HTTP IIS, Unofficial
500.24 An ASP.NET impersonation configuration does not apply in Managed Pipeline mode
HTTP IIS, Unofficial
500.50 A rewrite error occurred during RQ_BEGIN_REQUEST notification handling. A configuration or inbound rule execution error occurred
HTTP IIS, Unofficial
500.51 A rewrite error occurred during GL_PRE_BEGIN_REQUEST notification handling. A global configuration or global rule execution error occurred
HTTP IIS, Unofficial
500.52 A rewrite error occurred during RQ_SEND_RESPONSE notification handling. An outbound rule execution occurred
HTTP IIS, Unofficial
500.53 A rewrite error occurred during RQ_RELEASE_REQUEST_STATE notification handling. An outbound rule execution error occurred. The rule is configured to be executed before the output user cache gets updated
HTTP IIS, Unofficial
500.100 Internal ASP error
HTTP IIS, Unofficial
Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.

LinkedInGitHub