Categories
Tutorials

What is error 500 and how to fix it in WordPress

Table Of Contents

The internet has become an integral part of our mondaine routine as well as in our lives. We are swapped in the world of endless scrolling and everlasting online presence. 

As of the latest statistics, 4.57 billion people were active internet users, thus encompassing 59 percent of the global population. Such sky-rocketing figures, show the importance and influence the digital world has reached. 

For this article, we will tackle one of the most controversial occurring errors, the 500 error or the 500 Internal Server Error. When visiting a page or domain, you are sending a request to the web server for a certain page to be displayed.

HTTP status codes are a group of three-digit numbers that will provide information on whether the request was successful or not. If the request from the client – meaning you as a visitors was successful it will send back the 200 status code which is translated into the display of your page you were requesting for. 

But, when the webserver will encounter troubles along the way it will send back other digit codes like 400 or 500. The 400 error will indicate client errors, while the error 500 will indicate server-related issues. 

In this article, we will provide you with knowledge on what is an error 500 and how you can fix error 500 internal server. Stay with us. 

What is a 500 Error

As we mentioned previously for every request from a web browser the server will respond with a status code. The 500 code is a general code, which is usually translated into problems relating to the website’s server.

But the tricky part about these errors is that you never know the specific root of the problem that’s causing your website to break. That is why in this article we will break down all the most probable causes and solutions on how to fix each.

The 500 error message might be displayed in various ways, but they all mean one thing; there is a general issue happening on either your website or the website you are visiting.

Because every website has access to customize the error messages, it can take various forms, but one thing that doesn’t change is number 500. The error will not be limited to desktops, it will be generated in any browser or operating system including mobiles as well.

What are the causes of error 500?

When in case of a 500 error, it will run on every page on your website, due to the fact that there might be a problem with your server that’s powering your website.

When talking about WordPress, the most likely indicator that’s causing the error will occur in the root directory, where your WordPress files are stored. But, because this is a general error and it almost never has a straightforward solution, it is also worth checking with the host’s server. 

Most of the time, an error 500 will most likely be caused by a mistake in the permission on more than one file and folder. Setting the permission files correctly is fundamental to keeping your website secure, but also maintaining your site error-free. 

If no permission files are faulty then, you should check the PHP Timeout, as often helps the HTTP error 500 be displayed. If you have your script connected to external resources, then those resources expire it will cause damage and display an error 500. 

While not as common, just to stay on the safe side, sometimes, a coding error in the .htaccess file will result in an error 500 display. And as in most cases with WordPress users, plugins are a core part of your site’s extended functionality, sometimes poorly coded and incompatible extensions will be the cause behind your error. 

However, when trying to access content on a server that is running on  Internet Information Services (IIS) 7.0, 7.5 or later versions by using the HTTP protocol, then the IIS will return a numeric code that will indicate the cause of the error. You can find the list of the error codes here.  

How to fix error 500 on your website?

As a website owner, dealing with an error 500 will be a time-consuming and frustrating It will require taking a more serious approach as in the most abundant cases these errors will be server-side errors. It will be your problem to fix.

Let’s get into the more technical stuff and help you run your website as smoothly as possible and provide your visitors with the best user experience. Fixing on your errors will also help you stay on google’s safe side, as it will damage your reputation and it might result in a lower ranking. 

Back up your website

First and foremost, you should always take precautions when making changes on your website. Backing up your website is always a good idea, especially if you are going to correct your files or your code, in case all things go sideways. 

Most of the solutions will require you to make changes to your root directory, in such cases restoring your data is highly recommended prior to starting with any of these solutions. Learn how to Backup and Restore your data in WordPress with the help of this article

Creating a new .htaccess File

Sporadically, a mistake in the .htaccess file will be the indicator that the error 500 occurs on your website. The .htaccess file on your website might crash with the web page that you are trying to load thus resulting in error.

That is why it is recommended for the file to be checked for prosperous errors in syntax that could render the error 500 on your website. To confirm whether or not the error is caused by any mistake in the .htaccess file you could either remove or rename the file.

To do that open your WordPress root directory on your FTP client, The file is usually named public_html. Once you have access to your public_html file you should notice files like wp-admin, wp-content, from there locate the .htaccess file.

Now that you have located the .htaccess file, right-click on the file and click Rename. Change the file name to “.htaccess.bak”. What this will do is essentially delete your website’s .htaccess file, now we need to create a new one. 

Go to your WordPress Dashboard, then go to Settings > Permalinks and then click on Save Changes. 

Visit your website, and if the error 500 has been neutralized then the likely cause of its display as a corrupt file in the .htaccess file. But if you are still seeing the error then, you will need some more digging to do and try other solutions that will eventually eliminate the error. 

Note to remember: An improperly named .htaccess file will also cause the break of an error 500. Make sure that this file is not named anything other than the “.htaccess” file. 

PHP Timeout and Memory Limit

As we previously mentioned a PHP time will likely be the cause of your error 500 on your website, and there is a simple solution to this. In this case, the error is being caused by an issue in the web server, it is being caused by an interrupted connection to an external source.

If your PHP scripts on your website are set to gain access from other external sources, and if those sources are no longer available or the server communication is down for various reasons, it will cause the error 500 to break on your website.

One route to eliminate this source of error is not t be dependent on external sources, but if that is not currently an option you could try and increase the time limit of your script.

Your PHP memory limit can be determinant to the cause of the error on your website. The memory limit will determine how much memory a processor will use. In case that more RAM is needed than what’s available, this could result in an internal server error. The memory limit is often lower for shared hostings.

In such a case, you need to increase the PHP memory limit on your WordPress website and check if this is the faulty issue that’s causing the error 500. To do that you will need to open your root directory and locate the wp-config.php file.

Fix the 500 Internal Server Error by increasing the PHP memory limit

Right-click on the file and click Download to download it on your computer. Next, you will need to open the file in the text editor of your choice and add this bit of code under the opening PHP tag.

define('WP_MEMORY_LIMIT', '64M');

Save the file and then upload it again on the in your root directory, which should overwrite the original file. To check, refresh your website and if you are still experiencing the 500 error then you are not having issues with your PHP memory limit.

However, this is only a temporary solution, once your website is up and running you should check to find a solution for the memory limit, either look for the reason that your memory is high or convince your host to increase the limit on your server.

Deactivate faulty plugins

Plugins can be a culprit oftentimes in a WordPress website, causing errors like the error 500, incompatible issues will occur between themes and plugins and that might be for various reasons. To check if a plugin is at fault for causing the error 500 the only way to know that for sure will be to test the plugins by deactivating all of them. 

If you have access to the backend of your page, to the admin dashboard then you just go to Plugins > Installed Plugins, tick the box at the top to check all the plugins, and choose Bulk Action to Deactivate them. After you have deactivated all the plugins, you can go ahead and active one by one, always checking your page for changes after each activation.

If you notice that one of the plugins has caused a white screen, deactivate it and continue activating other plugins, again one by one to make sure there is no other faulty plugin. 

Installed plugin in WordPress Dashboard

But if any circumstances, you can not access the WordPress Dashboard then you will need to disable your plugins via the FTP client, and that shall take more effort.

All you need to do is connect your site using your FTP credentials and once logged in, go ahead and locate the wp_content file, and inside you will see the plugins files. Rename that folder to something like plugins.test, this will cause WordPress not to be able to locate them and thus deactivating all your plugins.

Check if the problem has been solved, refresh your website and if positive then go back and change the file name to plugins again.  

Permission Error

When dealing with errors in permission files, most likely there is a mistake in the PHP or CGI script that’s causing the error 500 to be displayed on your website.

Although a not common issue, checking the values of the permission fils will lead to better security and if you have set incorrect permissions on more files and folders then it will be causing the 500 Internal Server Error.

While setting the permission files you should bear in mind that there are three categories: User, the administrator of your website, this is your cPanel username. Group, here are collected all the other users on your website, that can be editors, contributors, or any other user you set in this category, and World/Other – everyone else on the internet. Each will have three different actions the users above can take upon these files and directories: Read, Write and Execute. Each number corresponds to a level of permission or a combination of permissions, Read – 4, Write – 2, Execute – 1, No access – 0.

According to this logic, you should assign your directory to be chmod 755. Anything other than that or 600 will leave your files vulnerable and will likely cause a break on the error 500.

You should be able to see your permission files on your FTP Client, as most providers offer quick and easy access to permissions for each file and folder.

How should internet users fix the error 500 ?

We already alluded many times in the article that the error 500 is most likely a server-side error, meaning that the problem is not probably with your computer or your connection.

The easiest way out of this you could reload or refresh the page. You can do that by clicking on the Reload button or using the keyboard shortcut F5 or CTRL+R. Even if there it’s a web server error, the issue might be temporary or if you are trying to access the page at the moment that the service is rebooting.

If the reloading option does not work then you should try to clear your cache, it might be possible that browser did not really reload the page, they served you with a cached version of the page.

To clear the cache To start the process of cache clearing in Chrome you will need to reach the three dots positioned at the top of the page, click on them, from there you will need to go to this More Tools options and click on Clear browsing data.

How to Clear Cache in Google Chrome

Note: If you happen to be displayed an error 500 during a checkout process while on an online store, you must not reload the page. Duplicate attempts to checkout will end up creating multiple orders, leading in multiple charges. Although most of the online store providers have automatic protection against such actions, it is still something to keep in mind.

If the cache clearing does not clear the air and eliminates the error 500, you could try deleting the cookies that are associated with the website you are trying to reach. Some Internal error issues can be corrected by this method.

If none of the above work then you should probably, try and notify the webmaster, and try reaching the website at a later time.

Final Thoughts

If you are having issues with the error 500 being displayed n your website, as a website owner there is no easy way to fix this, it will require some time and patience and a handful of knowledge to troubleshoot the error.

We listed the most common issues and their respective solutions to fix the error, but still you will need to access your web server’s log files to determine the specific cause of the error.

If all the efforts did will not result in error elimination you could try and contact your web host provider and have their support team debug your sit and fix the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *