500 internal server error is one of the most frustrating errors that can occur in WordPress. It never has a straightforward solution at all, requiring a lot of troubleshooting that can eat up your time and patience. But we’re going to try to help alleviate some of that stress by suggesting several solutions to this problem and walking you through each.
So, let’s get started…
How to Fix the 500 Internal Server Error in WordPress Website
Backing Up Your Site
These solutions require making a lot of changes in your site’s root directory. It’s highly recommended you backup your site prior to trying any of these solutions in case something goes wrong.
Common Solutions for the 500 Internal Server Error
The two most common causes of this error are a corrupted .htaccess file, exceeding your server’s PHP memory limit. The .htaccess file in your WordPress directory can become corrupted after you install a plugin or make another change to your WordPress site. All you need to do, create a new .htaccess file.
PHP memory limit issues often occur as the result of a poorly-coded plugin running on your site or a site that’s grown considerably over time and is using too many plugins. You will begin to exceed the PHP memory limits set by your hosting provider once either of these things happens. The result is a 500 internal server error.
We are going to learn how to create a new .htaccess, To get rid of the corrupted one as well as how to test whether or not you’re exceeding your PHP memory limits.
Creating a New .htaccess File
Open your hosting WordPress root directory in FileZilla or your preferred FTP client. This is typically called public_html. If you see folders named wp-admin and wp-content, you’re in the right place. If you don’t see your .htaccess file or any of the dot files, make hidden files viewable. Click Server and selecting Force Showing Hidden Files.
Once you find your .htaccess file in hosting, click right, and rename it “.htaccess.bak”. This essentially deletes your site’s .htaccess file. So, now we need to create a new one. Go into your WordPress admin area. Hover over Settings, and select Permalinks. Scroll down to the bottom of the page, and then click Save Changes.
Open your website in your web browser. If the 500 internal server error is gone, then okay. It was caused by a corrupted .htaccess file and your issue is now fixed. If you are still seeing the error, you have some more tests to run.
It’s also worth mentioning that an improperly named .htaccess file will cause this error to run on your site. Make sure this file is not named anything other than “.htaccess”.
Increasing Your PHP Memory Limit in WordPress
PHP memory limits are set by host and WordPress. WordPress will attempt to increase your limit if you begin exceeding it. But it can only go as high as the limit your host has placed on your server. This limit is often lower for shared hosting plans. You need to increase your PHP memory limit in WordPress and refresh your site to test whether or not this is causing your 500 internal server error.
Open your root directory, and locate your wp-config.php file. Right-click on the file, and select Download to download it to your computer. Open the file in your preferred text editor, and add this bit of code under the opening PHP tag:
Don’t get too excited if you don’t see the error. You still have some work to do. Let’s do
Increasing your site’s PHP memory limit in the wp-config.php file is the equivalent of pouring bleach down your kitchen sink when it smells like rotten eggs. You’re fixing the problem well enough to get rid of the offensive odor, but you’re not fixing the bigger issue at hand, which is likely a clog somewhere in the pipes that lead to your sink.
The same is true with increasing your site’s PHP memory limit. You may have increased it yourself in the file, but something is still exhausting your limit. You can follow these steps in the next few sections to try and find out what that might be, but if worst comes to worst, you will likely need to convince your host to increase the limit on your server.
Common Solutions for the 500 Internal Server Error
After fixing a corrupted .htaccess file and increasing a site’s PHP memory limit are the top two solutions for fixing this error, but there have other solutions if those haven’t helped you.
They are as follows:
- Deactivating plugins to check for faulty plugins.
- Locating issues by debugging your site.
- Checking if your files and folders have the correct file permissions.
- Uploading fresh wp-content and wp-includes folders to your site.
- Asking your host if the issue is on the server that powers your site.
If you are able to access the WordPress admin area, then deactivate all your plugins one by one. Refresh your site after each deactivation. If the error disappears, that’s mean it was likely caused by the plugin you deactivated prior to refreshing.
Delete that plugin and then find a replacement if its function is important for your site. If you don’t feel you can replace the plugin, contact the developer directly. You can do this within the plugin’s support forum on WordPress.org, but I recommend doing a bit of research to see if the developer offers support elsewhere.
If you have no access to the WordPress admin area, open your FTP client. Open the root directory, and open the wp-content folder. This folder contains your Plugins, Themes, and other folders.
Rename Plugins folder to anything you wish, such as “plugins.test”. This deactivates all of the plugins on your site. Refresh your site. If the error is gone, it was caused by a faulty plugin. Activate each plugin one by one, and refreshing your site after each activation, to find out which plugin is causing the error.
Make sure you rename the folder back to “Plugins” afterward.
Debugging Your WordPress Website
If you are having trouble figuring out what’s causing this error to run on your site, you may want to use WordPress’ built-in debugging feature. Pasting a bit of code into your site’s wp-config.php file enables debugging on your site. Any errors found are recorded in a file in your directory.
If you’re an average site owner, you may want to sit this one out as you may not know the difference between a minor error that can be safely ignored and a major error that should be taken care of promptly.
Normally, debugging a live site is frowned upon as it may reveal essential code to site visitors, among other things. However, it may be the only thing that explains what might be causing the 500 internal server error to run on your site.
Checking File Permissions
Open your root directory in an FTP client. Many clients, including FileZilla, have a Permissions tab you can use to quickly check the permissions for each file and folder in your root directory. Make sure these are not set to anything other than 755 or 644.
Uploading a Fresh Versions of wp-admin and wp-includes
In this, the step should be a last resort, but if you’ve used the above solutions and still cannot find one that works, it’s worth a try. So, backup your site, and download a fresh version of WordPress from the main site.
Refresh FTP client, and refresh your site. If the error is gone, it was likely caused by a corrupted core file. If you still see the error, you may have no other option than to contact your host.
Contacting to Your Host
If the problem solved through all of these steps and still cannot find a solution, your host may have it. However, important that you go through these steps to ensure the issue is not occurring in your root directory.
The quality of the support you receive differs between hosts, but many hosts may shrug the issue off and blame your site’s files rather than their servers. This isn’t out of the question as third-party plugins and themes do cause plenty of issues that are out of your host’s hands.
So, it’s important that you go through all of these steps so you can explain to them that you’ve checked every nook and cranny of your file system and can’t find a single issue that would lead to the 500 internal server error that’s running on your site.
Politely ask them to check their server logs to see if the issue is there.