HTTP error 500: Where does the problem lie and how to fix it?

HTTP errors indicate whether the request has been successfully processed and, if the processing failed, the reason. Error messages are not always understandable, and one of them is „500 Internal Server Error”. This error means that the problem occurred while connecting to the server and the website could not be loaded. Unfortunately, he does not provide information on what exactly went wrong. Fortunately, there are several methods to verify the actual cause. Below you will find the most common reasons for the 500 error, and what you should do if you receive it.

  1. What does „Internal Server Error” mean?
  2. What are the causes of the 500 error?
  3. How can website administrators fix the 500 error?
  4. How should visitors react when they receive an HTTP 500 error?

What does „Internal Server Error” mean?

By means of response statuses, the server informs the user’s browser whether his request (e.g. loading a web page) has been successfully processed. If we receive the status of 200, it means that the operation was successful. If the page has been loaded, the user will not see this status. If you receive a 400 or 500 code, the situation is different. 400 errors indicate the error at the browser level, while 500 at the server level. „Internal Server Error” is a cumulative status for server errors, which is why we are not always able to determine exactly what caused it. The user only knows that the inconvenience lies on the server side.

However, if Microsoft Internet Information Services (Microsoft IIS) has been installed on the server, we will get a detailed description of the error. Examples:

  • 500.0: Module or ISAPI error occurred.
  • 500.11: Application is shutting down on the web server.
  • 500.12: Application is busy restarting on the web server.
  • 500.13: Web server is too busy.
  • 500.15: Direct requests for global.asax are not allowed.
  • 500.19: Configuration data is invalid.
  • 500.21: Module not recognized.
  • 500.22: An ASP.NET httpModules configuration does not apply in Managed Pipeline mode.
  • 500.23: An ASP.NET httpHandlers configuration does not apply in Managed Pipeline mode.
  • 500.24: An ASP.NET impersonation configuration does not apply in Managed Pipeline mode.
  • 500.50: A rewrite error occurred during RQ_BEGIN_REQUEST notification handling.
    A configuration or inbound rule execution error occurred.
  • 500.51: A rewrite error occurred during GL_PRE_BEGIN_REQUEST notification handling.
    A global configuration or global rule execution error occurred.
  • 500.52: A rewrite error occurred during RQ_SEND_RESPONSE notification handling. An outbound rule execution occurred.
  • 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.
  • 500.100: Internal ASP error.

What are the causes of the 500 error?

„Internal server error” occurs when the server processes the request. Error 500 covers all unplanned server behaviors that result in the site not loading. Most often it appears due to incorrect configuration of the server or some of its files, for example:

  • Permission errors: File and folder permissions have not been properly configured
  • Request timeout (timeout): The script connecting to external resources has exceeded the maximum response time
  • Incorrect .htaccess configuration: The configuration or code in the .htaccess file may be incorrect
  • Errors in the syntax or code of CGI / Perl scripts: In some cases, the scripts were created incorrectly, or the paths have incorrect references
  • PHP memory limit: The process being executed has exceeded the memory limit and cannot be executed

For WordPress and other content management systems, the installation of incompatible or damaged plugins can also lead to the display of 500 errors. Plugins and themes (especially unofficial ones) can have a negative impact on the entire website.

How can website administrators fix the 500 error?

Do your website visitors receive 500 server error messages? As a website administrator, you should address the inconvenience as soon as possible, as the risk of losing users and lowering your Google ranking is high. Before you take the first steps, make sure the server is running; the fastest way is to query one of the domains that is pointing to your server. If we get an answer, we’ll have to look elsewhere for the reasons.

If there is an internal server error, then log insight will be a good solution. For websites running on Linux servers, error information can be found in the var / log / httpd / error_log file. It is good practice to refresh the page to reproduce the 500 error and observe what is happening in the logs; this will help find the cause of the error. If you have recently made any changes, for example adding a new plug-in to the page, this could be a source of generating an HTTP 500 error.

Errors can also arise if you configure the permissions for files and directories on the server incorrectly. There are three main types of permissions:

  • Read (r) – reading
  • Write (w) – write
  • Execute (x) – execution

The above rights are granted to three user groups:

  • File owner
  • User group
  • Others

Permissions are represented using the abbreviations r, w and x, or their corresponding digits: 4 for read, 2 for write, and 1 for execution. They are assigned to each user group in the correct order, for example rwxr-xr-x (rwx for the owner, r-x for the group, r-x for others), or 755. The 755 configuration should be the default – otherwise errors may occur.

You can change the permissions with the following command:

  • chmod 755 filename

If it does not bring positive results, you can raise the permissions for all user groups for testing purposes:

  • chmod 777 filename
Remember to use full permissions only to locate the problem. With this configuration, each user will have the opportunity to make changes (save), which is a big risk.

If the change of permissions does not bring positive results, the next step will be to verify that all scripts are working correctly. Errors can occur if files have been moved, modified (e.g. their name), or deleted. Also check the .htaccess file; syntax error – no matter how small – it can generate an internal 500 server error. It’s important to remember that the correct .htaccess file format is ASCII or ANSI – not Unicode. Creating a file. htaccess, take advantage with editors such as Notepad, Notepad ++, or Sublime Text – we do not recommend using with advanced text editing programs such as Microsoft Word. To test whether the .htaccess file is responsible for displaying errors, you can temporarily rename it or move it to another directory – the server will not read the file. If the 500 error has stopped occurring, look for errors in your file or create a new one.

Exceeding the request timeout can also lead to errors. It is not a server error, but information about the interruption of the connection to external resources. Do you have PHP scripts on your server connecting to resources outside of your server? These resources may no longer be available, or a connection to the target server may not be established for some reason. One way to eliminate this possibility is to create a page with the intention of not being dependent on resources outside of your server. However, if you know that this will not be possible, you can try to increase the timeout period for the script. In addition, we recommend using efficient error handling methods so that they are easier to identify when they occur and fix it.

The next element necessary to check is the PHP memory limit. There is a chance that it has been exceeded. The memory limit determines how much RAN memory resources can be allocated to process execution. If the process uses more resources than is currently available, this may result in errors such as error 500. Some servers – depending on their specifications – will allow you to change the default limit. You can change it using the following command in the php.ini file:

  • memory_limit = 512M

The above command changes the default memory settings to 512MB. Please note that if you enter a higher value than the one provided for your service type, it will be ignored. Verify with your service provider what the maximum PHP memory limit for your server is, and if necessary, consider buying additional resources or upgrading to a higher type of service.
If changing the limit allows you to read the page, check what is really causing excessive RAM consumption. It is likely that a code error results in a far greater use of resources than it should.

How should visitors react when they receive an HTTP 500 error?

As a website visitor, you can do little when you receive the 500 „Internal Server Error” – this is a server-side error. There is no error in configuring your operating system, network connection or browser. Because of this, the best way to get rid of the error message is to refresh the page. The likelihood that the website administrator already has the inconvenience is quite high; especially for large portals. However, you may find that you are trying to connect to the website at a time that is inconvenient for the server, for example when the machine is restarted or the software is updated. Then, despite everything going according to plan on the server owner’s side, you will receive a server error.

IMPORTANT! If you receive a 500 error while completing your order or online payment, don’t try to refresh the page. It is possible that only the confirmation page has not been displayed and the request has been successfully processed. In this case, refreshing the page may duplicate your order or payment.

In extreme cases, a sudden increase in website traffic can lead to a temporary server overload. If you still receive an error message despite refreshing your site, please clear your browser’s cache; otherwise, instead of loading the page from an already working server, the browser will use previously downloaded data
about site unavailability.

Are you still getting a 500 error? Unfortunately, you have no choice but to wait for the error to be corrected on the side of the administrator of the page or server. However, there is a trick to enter a temporarily unavailable website. If you are not dependent on loading the latest data shared on the site, you can use Google Cache. By entering the cache: command and then the website’s web address in the Google search bar, you can access one of the earlier versions of the page while it was still functioning properly. The reality, however, is that you will only get access to the archived version of the site saved on Google’s servers.

If you need to use an even older version of a website, try Wayback Machine. You can access versions of websites even ten years ago.

If the website you are trying to visit is unavailable for an extended period of time, you can of course try to contact its administrator. The administrator may not even be aware that the site is not working properly.

  • Czy artykuł był pomocny ?
  • Tak   Nie