WordPress Errors 500, 502, 504 & 508 – What Causes Them And How to Fix Them

      

As a website owner, you are bound to run into some errors every now and then. Those errors can be plentiful but in this post we will talk about the most common ones that everyone runs into frequently.

Let’s take a look at some common errors, what causes them and ways to fix them.

500 error: Internal Server Error

What exactly is this error?

It’s an Internal Server Error. It’s basically an HTTP status code related issue which is indicative of some underlying issue with the website’s server. But, the server is not able to pinpoint where exactly the error is lying.

Causes of this error:

.htaccess file

One of the commonest reasons causing one such error is incorrect syntax of the file (.htaccess). Another reason could be the presence of incorrect directives in this file.

You can find .htaccess file in –

cPanel>File Manager menu (make sure the ‘show hidden files’ option is enabled when trying to access it).

It’s recommended to rename the file to find out whether incorrect syntax is causing the error or not.

Use FTP for cPanel File Manager -> Rename to change the name. If this helps then .htaccess is the culprit.

In this is the case, start commenting out lines in the file by inputting # in the starting of every line.

If the error stops appearing after these modifications, check the error_log file and find the newest error records.

Make sure to uncomment the links and rename the file back.

Incorrect file/directory permissions

You can correct these permission by accessing –

cPanel > File Manager > Change Permissions

Make sure the permissions are correct.

Files – 0644
Folders – 0755

Reaching LVE Limits

Another reason causing the 500 error is the possibility that your hosting account is exceeding the set resource limit on the server.

Here’s how you can check it:

> Check out the ‘Resources Usage’ in cPanel
> Check out the SSH tunnel. Linux top -c command gives real time stats and data related to all the running processes.

NOTE: You may need to contact the support in order to access SSH since it’s not activated by default.

How to Fix: If case your account is reaching the resources limit, check the error_log file and see the latest error message. From there you can see which plugins or scripts might be causing the issue. After finding the culprit, you can optimize the account/site performance so that the site does not cross the resources limit any longer.

When all else fails, we recommend getting in touch with Hosting company and get the required technical aid.

502 Error: Bad Gateway

What does the error mean?

502 Bad Gateway is indicative of the proxy server failing to get a proper/valid response from the original server (aka upstream server) when trying to serve the browser request or load a web page.

Causes of this error:

When a web server is unable to process the request, that’s when this error appears. Typically improper functionality of the proxy servers, host server, or the DNS is responsible for such errors.

Some common reasons of this error are:

1. Increasing amount of load put on server.
2. Some intensive activity by cPanel users
3. Lack of server resources to handle the incoming requests
4. Internal technical failure may be causing this error.

504 error – Server unavailable

What does it mean?

It means that the server got an invalid response from another server when trying to load the page or complete a request by a browser.

Why does this error appear?

All the reasons that apply to 502 error apply to this one as well. The only difference is that instead of receiving an invalid response, the server received no response at all for a specified duration of time. This causes the request to time out and you get this error saying server is unavailable.

Most of the times, 504 error is connected to an excessive load on server.

How to Solve

Get in touch with the support team and see if the server is up and running. If there is no issue with the server, then perhaps your script is taking longer to execute. The best fix is to improve the PHP time limit for the script execution. You can do this in php.ini file by improving the max_execution_time value.

If you want to explore more options to fix the 504 gateway timeout error, check out this really helpful post.

NOTE: .htaccess file should have right php.ini path. Optimizing the script is another way to solve the issue.

508 error: Resource Limit Is Reached

What does this error mean?

This error implies that the website is hitting Entry Processes.

What causes this error?

LVEs limit the number of entry processes so that one website doesn’t end-up exhausting all the Apache processes. When the limit is reached, mod_hostinglimits can’t place processes into LVE and will throw error code 508.

To check your account’s resource usage, you will need to access

cPanel>Resources Usage menu.

If you need to check the resources in real time, you can use SSH command top -c. If the error is appearing frequently, you may need to optimize the script or upgrade the plan to the one with higher limit on server resources.

Solution:

You can check out this helpful guide on ways to fix this WP error.

You can also take a look at this detailed guide on how to fix the 500 internal server error issue.

Alternatively, you might need to upgrade your package to a plan that comes with higher resources limits. Alternatively, you can try to connect with the hosting support team.

Final Thoughts

As you can see, most of these errors are really easy to fix. You just need to know which course of action to implement at what time.

Sure some problems may require help of technical support, but majority of them can be fixed on your own.