If you encounter the 500 internal server error on your WordPress site, here are a couple of ways to go about it.
One thing I love about tech, especially stuff related to programming is that there is inbuilt error reporting.
Every imaginary scenario in which an app may fail is catered for providing developers accurate information on where the app is failing at and what part actual error is occurring, making it easy to troubleshoot it.
Unlike most errors you will encounter, the 500 Internal Server error does not explicitly tell you what is wrong with your website, making it annoyingly hard to troubleshoot and fix.
After fixing this error countless times, here are a couple of most likely scenarios you may experience it and how to fix it.
When you move your WordPress website to a new host, there is a high chance that you will see this error, but for most people, the error can be thrown even they have not done anything to the website.
The 500 internal server error is often isolated to two scenarios, software or plugin related issues and hardware related issues.
Before we get into the nitty-gritty, backup your website, some of the recommendations involve tampering with your files; you would want to make worse the already bad situation.
Troubleshoot Software related issues
Okay, I know most articles you are going to read about fixing the 500 internal server error do not mention this, well, most of those are written by copywriters who do not manage a website.
The last 3 I had to fix the error on turned out that just saving the permalinks fixed the issue. Workaround code long enough, and soon you will find out someone of the solutions to annoying errors is simple.
So before you get into the technical aspects below, start with this.
Permalinks are found under Settings.
Start with the .htacess access file
The .htaccess file is a configuration file found in the top level directory of a website on an Apache server that adds or removes functionality needed for WordPress, plugins, and themes to run well.
If an issue is to arise with this file, the website will most certainly break and start showing errors; the most common error associated with a corrupt .htaccess file is corrupt is the 500 Internal Server error.
Since it is the typical culprit, we start with this file for the fix.
All you need to do is log in to your file server and rename the .htaccess file.
Then try to access your website, WordPress by default will recreate the .htaccess file with its default settings.
In our experience, this fixes over 80% of the 500 Internal server errors we have seen.
Increase PHP Memory Limit
The next most likely reason your website shows this error is when your site, theme or a plugin requires more memory to run than is currently defined.
Your host and WordPress configuration have defined memory limits that applications need to work within, if renaming the .htaccess file did not work for you, then try to increase the PHP Memory limit in your wp-config.php file – you could check with your plugin and theme documentation for the recommended PHP Memory Limits.
In the wp-config,PHP file that you will find in your public directory, add the line of code below just after the opening PHP tag. You can replace 64M with the size recommended by your plugin or theme.
Refresh your website and see if this fixes the issue.
However, if your website has been performing and all of a sudden, you start seeing the error, then you would have to investigate further what plugin is hogging the memory.
Check the theme or Plugins
Some times the culprit is a buggy plugin or theme. However, before you start troubleshooting them, check if your theme or plugins have any updates that you can apply. If updating does not get rid of the error, then it is time to move on.
To isolate if a theme causes the error, switch themes, and see if this fixes it.
You can do thus under themes in Appearance. Active the default WordPress themes – Twenty Seventeen for instance and check if your website.
If your website works after switching themes, then we can conclude the issue is with the theme. You can contact your theme developer for possible solutions to the error.
If that does not solve the issue, you can reactivate your theme and move to troubleshoot the plugins.
For the case of plugins, start by disabling all the plugins, check your website, if the error is gone, then we can confirm that one plugin could be a culprit.
If that fixes the issue, then its time to reactive the plugins one by one, as you do, keep refreshing your website until you find one that will return the 500 Internal Server Error.
When you land on the culprit, you can contact the developer and hope that they can fix the issue.
Reupload core WordPress website files
If any of the steps above do not fix the 500 internal server error, try to replace the existing WordPress core files in the wp-includes, and wp-admin directories with a clean copy to rule out corrupted WordPress files.
You can download the files from wordpress.org
Troubleshoot Hardware Related Issues
Contact your host’s customer care
If you try all the above methods and the 500 internal server error is persistent, then contacting your host is the only option left.
As you have seen in the earlier steps, the typical culprits for this error are related to your theme and plugin.
This is often outside the purview of web hosts, so you will need to explain to your host everything you have done to try to fix the error.
If this is the first time you see the error, I understand how it can be a daunting experience, but after reading this article, you should breathe knowing that it is not isolated to you.
Moreover, with the tips here, you will be able to troubleshoot and fix the error fast.
We recommend maintaining a regular backup schedule for your website. In a scenario like this, rolling back to a previously working version of the site could be a solution in the short term especially if the cause is related to recent changes in the software on the site.
You may also want to learn how to fix the 502 bad gateway error in WordPress.