Internal server errors are not always related to WordPress, as they can be a result of everything being run on your server. The error has generic nature, meaning that it doesn’t indicate the root cause right away. Therefore, developers are seriously challenged to fix them, something similar to a doctor trying to cure a pain he knows nothing about. In most of the cases, server errors are connected to dysfunctional plugins and themes, PHP memory exhaustion, and corrupted .htaccess files.
What makes fixing 500s even more difficult is that they are rare, and can only be seen when accessing the admin area. Sometimes, it takes months before discovering them, since everything else on the website works perfectly fine.
Let’s check a few useful solutions that can help you fix 500 internal server errors:
Fixing 500s requires multiple changes in the root directories, meaning that there is a huge chance that information will be lost when applying the appropriate solution. Doesn’t happen always, but you still need to backup the website and keep your website information safe.
Test the .htaccess file, and check whether it is corrupted
This should be the first operation when fixing internal server errors in WordPress. What you need to do is to rename the file, and put something like .htaccess_old. In order to do it, you’ll have to log in with the FTP, and look for the file in your wp directory (the same one containing wp-content, wp-includes, wp-admin, and similar folders.
While renaming, you can choose whatever name you like or you think you’d remember, or you can even make the process simpler by downloading a file copy on the device, and deleting the original from the server.
In order to check whether your 500 internal server error is gone, reload the website. If it is no longer there, that means that the .htaccess file was corrupted, and you have nothing left to worry about. Save the changes to Settings > Permalinks, and a completely new .htaccess file will appear. We also recommend an additional check on every page/post, to see whether it is loading properly.
In case you check the .htaccess file and conclude it is not corrupted, check the other solutions mentioned in this article.
Check the PHP memory limit, and increase it if necessary
Both WordPress and your host are responsible for determining memory limits, the accent being on the later. What it means is that when you exceed your PHP limit, WordPress can’t increase it if the server doesn’t allow it. The best way to eliminate this issue is to avoid shared or low hosting plans from the very beginning, admitting, however, that this is not something everybody’s budget can allow. So, how do you test whether your PHP memory is responsible for the 500 internal server errors? Better yet – how do you fix the issue?
Go to the wp-config.php file (you can use the FTP or the cPanel’s File Manager), open the main PHP tag, and add this line:
Save the changes.
Note that this is a temporary solution and that the only way to locate the real problem and to increase the PHP memory limit is to reach out to your hosting provider.
It may even happen that increasing the memory doesn’t remove 500 errors, which unfortunately requires expert troubleshooting.
Check the plugins and the themes
Dysfunctional plugins and themes are often causing 500 internal server errors, being among the most persistent problems which require hours of testing to capture the real problem. Unfortunately, there is no ‘easy way’ to identify the culprit.
The process is simple but time-consuming. The first thing that has to be done is to switch to the default WordPress theme (Twenty Sixteen, for instance), and to deactivate plugins one by one. Eventually, 500s will stop appearing, and you will be able to locate the exact plugin and to remove it. Once done, re-enable the theme, and test it again by reactivating the plugins. Test until you spring the error, and remove the delinquent. This should solve the problem, but in case it doesn’t keep reading!
The worst scenario is that a core WordPress file has been corrupted because you will need some advanced coding knowledge to solve the problem. What you should do is to open the file and to add a code snippet to it, but you have to be really careful while doing it in order to avoid syntax errors.
When your website experiences 500 internal server errors because of a corrupted core file, the easiest way to eliminate them is by uploading a fresher wp-admin and wp-include folders, or an entirely new WordPress version for more installation. The only thing to avoid is messing with the wp-content folder, because all data is there, and you’re risking losing it.
Wrong file permissions
Sometimes, WordPress plugins/themes permissions are not set at 755 (folders) and 644 (files), and that results in 500 internal server errors. Setting them more loosely, however, is not the best idea, as contrary permissions won’t eliminate the problem. In fact, doing it can cause even more serious WordPress issues.
Debugging the website
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 );
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );
The in-debugging WordPress feature may prove invaluable in cases where you simply can’t locate the problem causing 500s. As you saw, debugging is as simple as pasting few codes into the wp-config.php file, which should be enough to record all errors in a single directory file.
The host knows better
In the worst case, not even debugging or re-uploading will be enough to solve the problem, and you will have to contact your hosting provider. The good thing is that there is no problem that cannot be solved, so remain patient and let the hosting provider explore the error. An expert will take a look on your website, and will locate the issue much faster than you would.
Relying on your provider, however, depends on the quality support they can offer, so don’t be surprised if they shrug your issue, and blame the website instead of the quality of their own services. Sometimes, they will even be right about it: can you really be on the quality of every plugin/theme you’ve installed lately?
What matters is to go step by step, and to eliminate one potential cause after another. If nothing works, you’ll be able to justify your request to them, and to explain that you’ve done everything possible to solve the problem without their help. That way, they will understand that the issue is completely within their competence and responsibility.
Servers employ many different systems and software, each of them being able to cause 500 internal server errors. In case the error is connected to WordPress, this article should be enough to locate the problem and to fix it. If none of the ideas seems to do it, it is time to contact the hosting provider, and to throw the ball in his court.
Summing up, your responsibility is to backup and update your website regularly, paying specific attention to new plugin/theme versions and core file updates as they become available. Another good idea is to keep in touch with your theme developer and to consult him on plugin compliance issues in advance. It is essential for every website to have compatible themes and plugins because the opposite can cause serious corruption of core files (the .htaccess file, for instance).
Finally, keep your hosting package updated. This is even more important when running a site on a low-budget provider. In case your budget allows it, research better options and move to a server which can actually support a growing website.