If you have a WordPress site, one of the common errors that you may encounter will be HTTP Error 500. This could be really confusing for site owners, particularly so if you are a beginner of WordPress. What will you do if you are getting HTTP Error 500? And why are you getting this error? You may have to find out the reasons for the error and then try out different options to fix it. In this article, we will discuss some of the reasons for HTTP Error 500 and the ways to fix it.
Understanding HTTP 500 Internal Server Error
An Internal Server Error is displayed when your server is not able to display the requested page. It can be issue on your web server, and is somewhat of generic nature. From this error, you may not be able to understand much the underling cause. There are several common reasons for this error, which includes the misbehavior of a plugin or theme that you have installed. It could be also due to a corrupted .htaccess file or problems with the PHP memory limit.
Now, we will look into the possibilities that might help you troubleshoot this error.
One of the first strategies that you can try out to troubleshoot an error on WordPress would be to turn on debugging. Now, this will not resolve the issue for you, but it will help you figure out what is wrong.
To turn debug mode on, you will have to access the wp-config.php file. When you search for the content inside this file, you should be able to find WP_DEBUG. This has to be set to ‘true’ to enable debugging. If you are not able to find WP_DEBUG within your wo-config.php file, you can simply create it.
Basically, you need to have the following code in the wp-config.php file to turn on debugging.
define( "WP_DEBUG", true );
Now, if you try to reload the site, there is a chance that the error has changed. There is a chance that now the error has changed and the new error is pointing to a specific line of code with the issue. This will actually help you understand the exact nature of the problem, and you can directly address it and fix it. For example, if the error is pointing to a plugin or theme, you can simply disable that to get rid of the issue. If there is no change after turning on debugging, you can still keep it as ‘true’ until the issue is resolved.
Try a debugging plugin
You can use a debugging plugin that will help you identify problems. Here is a popular one:
This plugin will help you with the debugging of different problems that you may encounter on your site. These include database queries, PHP errors, debugging of AJAX calls, identifying performance issues with plugins, etc. It helps you identify problems on your site through an organized display of debugging information of a page.
Check the plugins and themes
Sometimes, when you are facing internal server error, you may still be able to access the WordPress admin page. If this is the case, you can check if one of your plugins or themes is causing the issue. For this, first, you can deactivate all the plugins on your site, and then try and reload the site. If the error has disappeared that means the issue was with one of the plugins. Now, you can activate the plugins one by one and see if the error reappears. This way, you can easily figure out if one of the plugins is causing the error.
If you can’t identify a problem with the plugin, there is a chance that your theme is creating the issue. The best way to know this is by switching to the default WordPress theme. If your site is loading fine after this, that means the issue is with the theme. You can contact the customer support of the theme, or get the help of a developer to find the specific issue with the theme.
Increase the memory limit
One of the reasons for internal server error could be the memory limit on your site. Sometimes, a badly-coded plugin or theme will be cause for exhausting the memory limit. Even though it is not a permanent fix for the problem, you can temporarily avoid the error by increasing the memory limit. Experts warn that this is not a recommended fix, and you should investigate further to understand what is exhausting the memory.
Just like you enabled debugging, you can find the wp-config.php file from your root WordPress install. Search for the following line in the file:
You can simply increase the memory limit by specifying a higher value here. For example, you can replace this line as given below:
This should be good enough to help you get over the error if memory limit is the issue. You can also contact your hosting service to understand if there is an issue with the server. If the server is not really optimized for a seamless WordPress experience, you can even consider switching to another hosting service. These kind of problems related to the server can often be seen with shared hosting services.
Fix problems with your .htaccess file
The .htaccess file holds a few server configuration rules that could be critical to the functioning of your site. Any problems inside the .htaccess file could lead to the error. Now, how will you find out if the problem is actually due to a corrupted .htaccess file?
Use FTP to find if there is a .htaccess file in your WordPress root directory. Make sure hidden files are visible on the FTP editor. If you are able to find the .htaccess file, you can create a backup of this file by renaming it. Now, you have to delete the original .htaccess file and all its contents. After this, you can try reloading the site. If the problem was with a corrupted .htaccess file, deleting the file and its contents will solve the issue for you.
You can create a new .htaccess file by accessing Settings > Permalinks and simply clicking the Save Changes button.
Check your PHP version
You need to find out the PHP version that is running your site. Simply using an older version of PHP will not cause an internal server error. However, if a plugin is using functions that is not available on older versions, it can result in an error. Contact your hosting service provider and find out the version of PHP that you are running. If it is a really old version, request them to update to the latest version.
Re-uploading core WordPress files
In most cases, this won’t be a definite solution to the problem. However, experts suggest to try this out if none of the other strategies are working for you. Before doing this, you should create a backup of your site, and then download a fresh version of WordPress.
Access your site’s root directory using FTP client, and replace the existing wp-admin and wp-includes folders with new versions. Refresh your site and if the error is gone, you can assume it is due to a corrupted core file.
Identify if there are more than one issue
There is a possibility that there is a combination of issues that is leading to the internal server error on your site. It is important that you are able to identify if this is the case. One way you will be able to identify this will be if you try out the above mentioned troubleshooting steps in a sequence. Ensure not to undo the changes after each step, so even if more than one is causing the trouble, you will be able to identify them.
Contact your host
If you have tried troubleshooting the HTTP 500 Internal Server Error with all the available strategies, you may contact your hosting service provider. Sometimes the problem will be from the hosting service’s end, which you may not be able to control. However, it is always better that you go through the above mentioned to rule out an issue from your WordPress root directory.
They will be able to go through the server log and identify the real cause of the error. Most of good hosting service providers will have a good customer support team to help you out in case of real server issues.
Generally, internal server error can be a frustrating experience for WordPress beginners. It is due to the ambiguous nature of the error that it often needs an expert to identify the root cause of the error. You can always opt for the services of one of the popular WordPress maintenance service providers if you don’t want such issues to recur.