Internal Server Errors (500 internal server errors) are the worst that can happen to any website and not just WordPress. The error can happen all of a sudden and is not giving the user many details.
If you’re fortunate, the WordPress administrator still operates but might also fail to comply in certain instances. We’ll explain in this article what an internal server error is and, more importantly, how to solve it.
What Is an Internal Server Error
Often plugin or theme function triggers internal server error in WordPress. Other potential causes of WordPress internal server error include corrupted .htaccess file and PHP memory limit.
Moreover, we have noticed internal server errors that only occur when you try to access the admin area while the rest of the site is running perfectly.
How to fix 500 internal server error
1. Turn on debugging
Whenever you face a WordPress error. It is recommended that you turn the debugging on. This will give you an insight into exactly what the error is.
Editing the wp-config.php
file on your site will turn to debug on. After you’ve opened this file, look inside the file for WP_DEBUG
. If you find it you should be able to set it to “true.” If you don’t see it there, then you’ll have to create it yourself.
Either way, you will see something like this: define( "WP_DEBUG," true );
After saving the file, reload your site to see if something has changed. If you’re lucky, the error on the server could vanish and be replaced with another error, which tells you where the problem is.
If you find the error, remember the location of the error. And check out the error in the plugin folder, disable the effected plugin and the error should be removed.
Even if turning on debugging doesn’t give you a great result, it’s a good idea to leave it on until the issue is resolved. It will give you and any developer more insight into what’s going on. Don’t forget to turn to debug off once everything’s ok and you’re done with the maintenance!
2. Change themes and deactivate all plugins
After you get the error, if you still have access to your dashboard, you should disable all of your plugins and see whether or not the error persists. If your website loads without an error, there is an error with one of your plugins. You can switch plugins one by one to find out which one caused the problems.
Most of the time, this error is caused by plugins, so this may be the area that caused the error.
If the error is not with your plugins then, you can also change your theme to a WordPress default theme like Twenty Twenty or Twenty Nineteen. If the site loads without an internal server error, the issue will be within your theme.
3. Check your .htaccess file
You will have to check for the corrupted .htaccess file. By renaming your main .htaccess file to something like .htaccess old. To rename the.htaccess file, login to your site using the FTP or File Manager app in the dashboard of your cPanel hosting account.
Once you’ve logged in, the.htaccess file will be in the same directory where you’ll see folders such as wp-content, wp-admin, and wp-includes.
Once the.htaccess file has been renamed, try visiting your site to see if this solved the problem.
Make sure you go to Settings » Permalinks page in the WordPress admin area before you move on with other things, and click the save button without making any changes. This will generate a new .htaccess file with proper rewrite rules to ensure that a 404 error is not returned on your post pages.
If you still having the issue, continue reading this post.
4. Increase your memory
Open wp-config.php
file in the WordPress root directory to increase your memory, and search for WP_MEMORY_LIMIT
. If it does exist, change the value to “64M.” If not, paste the following line into the file:
define('WP_MEMORY_LIMIT', '64M');
If this works then you’ve only temporarily solved the problem. Chances are you’ve got a faulty bit of code somewhere (which could be a plugin from a third party) that will exhaust your resources. If your host has monitoring available, take a look at your resource use with different on/off plugins to get a better idea of what those precious megabytes are wasting up.
5. Ask your host
If all methods fail to fix your website’s internal server error, then it’s time to get some more help. Contact your support team of web hosting and they’ll be able to check server logs and locate the root cause of the error.
I hope this post will help you fix the 500 Internal Server Error, If it does, please share the post on social channels.