Errors 500, 502, 504 and 508. Reasons and ways of fixing

Errors 500, 502, 504 and 508. Reasons and ways of fixing

500 error: Internal Server Error

What does it mean?

The Web server encountered an unexpected condition that prevented it from fulfilling the request by the client for access to the requested URL.

Why does it appear?

1. .htaccess file

The most widespread reason of such kind of an error is the incorrect syntax of the .htaccess file or existence of incorrect directives in it.

.htaccess file can be found in cPanel > File Manager menu (do not forget to select Show hidden files when accessing it).

We recommend starting re-naming the .htaccess file temporarily to understand whether the issue is related to it or not. You can use FTP or cPanel File Manager -> Rename option. If this helped and you’ve found out .htaccess is the culprit, start commenting out lines in .htaccess by adding # to the beginning of each line one by one.

In case the error does not disappear after the .htaccess file modification, you need to check the error_log file and the latest PHP error records in it.

Do not forget to rename the file and uncomment the lines back.

2. Incorrect permissions of a file or directory

That can be another reason for 500 error. Permissions can be corrected in cPanel > File Manager > Change Permissions.

Mind the correct permissions:

files – 0644
folders – 0755

3. Reaching LVE limits

It is possible the error is caused by the fact that your hosting account is exceeding virtual resource limit. There are several ways of checking it:

Resources Usage page in cPanel
Through SSH tunnel. The Linux top -c command will show real-time information and statistics about your running processes.

NOTE: SSH is not enabled by default. You need to contact the Live Chat team in order to get the access.

Solution: If your account is reaching its LVE limits, we recommend to check the error_log file and the latest error messages to find which script, plugin, etc. causes the issue. Once you know the cause, you should optimize your site/account performance to ensure it does not hit your account resource limits anymore.

If the steps above did not help, submit a ticket to Hosting – Support department and our technical specialists will assist you.

502 error: Bad Gateway

What does it mean?

The server received an invalid response from another server it was accessing while attempting to load the web page or fulfill another request by the browser

Why does it appear?

It appears when the Apache web server is not able to process the request. Such error can be connected with the incorrect functionality of a proxy server, DNS server or hosting server itself. Below you can find the most common reasons of the error:

1. The increasing load on a server. It may be caused by resource intensive activity of some cPanel users, internal server technical failure or lack of server resources to process all incoming requests.

2. Our technical team catches such errors during the regular monitoring, and it generally takes from 10 to 30 minutes to fix it and restore normal functionality.

So if you receive 502 error while trying to access your site, try to access it in 10 minutes again and if the error is still there, contact our Live support team.

504 error: Server is unavailable

What does it mean?

The server received an invalid response from another server it was accessing while attempting to load the web page or fulfill another request by the browser.

Why does it appear?

The reasons of this error are almost the same as for 502 error. The difference is that unlike 502 error where the invalid response was received from the server, the response was not received at all within a specific time frame. Thus, the request timed out stating that server is unavailable. That means that during the highest load peaks, Apache is not able to process the amount of requests and put them into a queue.

Since the error is in 90% of cases connected with the server load, and all services are monitored, our Technical Team is notified about the issue right away and is able to resolve it within 10-30 minutes. Once more, the possible reason is the script in your account that requires more time to execute than it is configured on the server by default.

Solution: Check our status blog or contact our support team to ensure the server is up and running. If the server’s performance is normal, most probably one of your scripts requires more time to execute. The solution for this case is to increase PHP time limit for script execution. It can be done in the php.ini file by increasing max_execution_time value. Note that suPHP_ConfigPath in .htaccess should already contain the correct php.ini path. The optimization of a script performance is the second way of fixing the issue.

508 error: Resource Limit Is Reached

What does it mean?

It means that your website is hitting one or more of the hosting account’s virtual resource limits: CPU Usage, RAM Usage, I/O usage or Entry Processes.

Why does it appear?

The error message appears when the account is exceeding the allocated resources limit (CPU, RAM usage and/or the number of concurrent processes running under your cPanel account). You can check the resource usage of your account by logging into cPanel > Resources Usage menu or in real time using the SSH command top -c. If the error appears too often, optimization of scripts or an account upgrade to the plan with higher server resource limits will be required.

Solution:

1. If you are a WordPress user, refer to our specially created article.

2. If it is a permanent issue and the above suggestions did not help, then it is recommended to consider upgrading your hosting plan to the package with higher server resource limits. Remember this article describes the most common reasons of the errors and common practices to fix them. If the recommendations do not help, contact us via Live Chat or the ticket system and we will be happy to help.