Best Ways to Troubleshoot 500 Internal Server Error in WordPress
While working on WordPress, it is very common to face errors. There are many WordPress error messages people deal with every other day. And one such common WordPress error is the 500 Internal Server Error. If you have been dealing with this WordPress error for a long but have not found the right solution, you have come to the right place. Through this article, we will help you learn more about this WordPress error message. Besides, we will also help you troubleshoot the 500 Internal Server Error in WordPress. Keep reading this article.
WordPress errors are very annoying, especially when you are a beginner and the error message does not have much information about the root cause and fix. As compared to other WordPress errors, internal server errors are the worst because they do not provide any information about the problem. There are many internal server errors, and the “500 Internal Server Error” is one of the most common WordPress errors.
500 Internal Server Error
The 500 internal server error refers to a situation when the server encounters an unexpected issue that prevents it from fulfilling the request. If there is a problem with the server or the file system that powers your website, you will encounter this error message on every page of your website. However, the definition of this WordPress error is rather unclear. The only certain thing is that the error occurs when some operations go wrong on the website’s end.
This error message not only appears on a WordPress site but also on other sites. Particularly in WordPress’s case, the reason is most likely to be associated with the root directory where your WordPress files are stored. If you receive this error, this means a script that is a part of your WordPress theme or plugin has done something wrong, and as a result, your server has crashed down. Now the question is – how to troubleshoot the 500 internal server error.
How to Troubleshoot 500 Internal Server Error?
The 500 internal server error is one of the most frustrating WordPress errors. Although it does not have any straightforward solution, there are a few troubleshooting tips you should consider trying. Remember, the tips we are sharing here are performed manually so they may require a lot of time and patience.
Important note: Before trying any of the manual solutions, do not forget to take the backup of your WordPress site. Backing up your site ensures that all your site’s data will remain safe even if any mishap takes place while troubleshooting the above WordPress error.
#1 – Use WordPress’s Debugging Feature
Whenever you face a WordPress error (especially a white screen of death or a server error) and you do not know how to deal with it, the best approach you should do is to use the debugging feature of WordPress. Even if it may not be able to fix the problem, it will provide helpful insight into what is going on, i.e. the reason why the problem is occurring. To turn on debugging on your site, go to your wp-config.php file and search for WP_DEBUG. If you find it, you need to set it to true. Then the code will look like this –
define( “WP_DEBUG”, true );
Important note: If you cannot find the code in the wp-config.php file, you need to add it manually. Refer to this article for more information – How to Enable Debugging in WordPress.
After saving the wp-config.php file, try to reload your WordPress site to check if anything has changed. There are high chances that the 500 internal server error would disappear or maybe it would get replaced with a different error that tells the exact issue. In that case, read the error message and you will get enough information about it, i.e. what causes the error and how to fix it.
But, if enabling the debugging feature does not work for you, we suggest you keep it enabled until the WordPress error is resolved. As previously mentioned, it will provide helpful insight into what is going on, i.e. the reason why the problem is occurring. And once everything is okay, i.e. no error message, do not forget to disable debugging.
#2 – Deactivate Plugins or Switch to Default Theme
If the debugging feature of WordPress does not help much, you should try to deactivate the plugins you are using. Sometimes what happens is that there is a faulty plugin and we do know about it. If any of the plugins you are using is faulty, you may receive a WordPress error like this one – 500 internal server error. So if your WordPress site has multiple plugins installed, you should deactivate them one by one to find out the faulty plugin. And if you find the plugin that is causing the error, either update it or remove it if no update is available.
Sometimes a WordPress theme can also cause server errors. So, to check if the theme is really causing the issue, switch to a default theme or any unaltered WordPress theme like Twenty Twenty or Twenty Twenty-One. If your WordPress site loads without the 500 internal server error, your theme is the real culprit. Try to update your theme, or if the update is not available, it is better to switch to a different theme.
#3 – Check .htaccess File
If the issue is not associated with the faulty plugin or theme, maybe you should check the .htaccess file if it is corrupted. Sometimes, due to a corrupted .htaccess file, you may receive an internal server error. The .htaccess file contains different rules that tell the server what to do and when to do it. It is mainly used to rewrite URLs and prevent unauthorized access.
To check whether the .htaccess file is corrupted or not, log in to your WordPress site using FTP or the File manager app in the cPanel dashboard of your hosting account. The .htaccess file is located in the WordPress root folder. Once you find the .htaccess file, rename it to .htaccess_old or anything you want. After renaming the file, try to load your WordPress site again to see whether the issue is resolved or not. If the error does not appear anymore, this means the problem was associated with the .htaccess file.
Here you need to create a new .htaccess file. To do that, go to Settings > Permalinks in the WordPress admin area, and simply click the Save button. Make sure you do not make any changes there. This will successfully create a new .htaccess file with all the rules so that the 500 internal server error will not occur again.
#4 – Increase Your PHP Memory
Sometimes the 500 internal server error can also occur if you are dealing with the PHP memory limit. If you are receiving the error while trying to log in to your WordPress admin or uploading an image there, this means you need to increase your PHP memory limit. To do that, follow the steps given below –
- First, go to your root directory and locate the wp-config.php file.
- Then, right-click the file and click Download to download it on your computer.
- Now, as the file is available on your computer, open it in the text editor (whichever you are using). You need to add the following code right under the opening PHP tag –
- After making the changes, save the file. Then, upload this file to the root directory. This will overwrite the original file.
Now, refresh your client as well as your WordPress site and see whether the internal server error still appears or not. Don’t get excited if the error does not appear again because you have only fixed the issue temporarily. You still need to figure out the root cause of why your PHP memory limit is being exhausted. We suggest you contact your hosting provider to look into the issue.
But if the 500 internal server error still appears, however, we suggest you contact your hosting provider. The issue may be associated with the server that powers your WordPress site. And if that is so, only your hosting provider can help you here.
The 500 internal server error is one of the most frustrating WordPress errors because it never tells about the real issue or provides any insight into how to fix it. In this article, we have discussed this common WordPress error in detail, and also found out the most effective troubleshooting tips. The article has 4 different manual solutions. Try each of them one by one, and let us know which of them works for you. Also, please tell us if we missed any other effective solution that worked for you.