The 500 internal server error runs on every page of your site when there’s a problem with the server or file system that’s powering your site. The cause most likely occurs in the root directory, where your WordPress files are, but it can also be caused by a problem on your host’s server.
This is one of the most frustrating errors that can occur in WordPress. It never has a straightforward solution, 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.
Let’s get started.
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.
Using an FTP Client
If you already have experience using an FTP client, skip this section. I’m going to go over how to set up an FTP client for those who have never used one as most of these solutions require it.
An FTP client allows you to access and edit your site’s files. You can use the File Manager your host uses, of course, but an FTP client of your choosing is often easier to use.
There are many FTP clients, but we’re going to use FileZilla for the purpose of this demonstration. Go to FileZilla’s homepage, and click Download FileZilla Client.
Click the green Download FileZilla Client button if the site is recommending your exact operating system. If it’s not, click the Show Additional Download Options link beneath the green button and download the version that’s appropriate for your operating system.
Open the client once you’ve downloaded the installer and have installed it on your system. Click File > Site Manager. Click New Site, and enter your site’s name.
Configure these settings:
- Host – Your domain name
- Port – Leave blank
- Protocol – FTP – File Transfer Protocol
- Encryption – Only Use Plain FTP
- Logon Type – Normal
Use the username and password you use to access your host’s file manager. If your host uses cPanel, use the login information you use to access cPanel. If you’re not sure, ask your host.
Go to the Transfer Settings tab, and select the checkbox for Limit Number of Simultaneous Connections. Set the Maximum Number of Connections to 8. This keeps your site’s server from blocking your IP address. Click Connect to connect to your site’s server.
You’re ready to go!
Common Solutions for the 500 Internal Server Error
The two most common causes of this error are a corrupted .htaccess file and 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. The fix is simple. All you need to do is 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’ll begin to exceed the PHP memory limits set by your hosting provider once either of these things happen. The result is a 500 internal server error.
We’re 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 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 dotfiles, make hidden files viewable by clicking Server and selecting Force Showing Hidden Files.
Once you find your .htaccess file, right-click it, and rename it “.htaccess.bak”. This essentially deletes your site’s .htaccess file, so 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 click Save Changes.
Open your website in your browser. If the 500 internal server error is gone, it was caused by a corrupted .htaccess file and your issue is now fixed. If you’re 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 your 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:
Save the file, and re-upload it to your root directory, overwriting the original file. Refresh the client, and refresh your site. If you still see the error, you are not having PHP memory limit issues. Remove the above code from the wp-config.php file on your computer, save it, and re-upload it to your root directory.
Don’t get too excited if you don’t see the error. You still have some work to 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 the steps in the next few sections to try and find out what that might be, but if worst comes to worst, you’ll likely need to convince your host to increase the limit on your server.
Less Common Solutions for the 500 Internal Server Error
Fixing a corrupted .htaccess file and increasing a site’s PHP memory limit are the top two solutions for fixing this error, but there are 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’re able to access the WordPress admin area, deactivate your plugins one by one. Refresh your site after each deactivation. If the error disappears, it was likely caused by the plugin you deactivated prior to refreshing.
Delete the plugin and 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 cannot access 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 the 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, 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’re 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.
Josh Pollock wrote a post on how to use this feature in WordPress a while back. If you’re a developer, go ahead and start debugging your site. 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
This likely isn’t the issue, but it’s still worth checking. In your WordPress directory, permissions for folders and files should be 755 or 644. Setting permissions to anything else may cause problems, including 500 internal server errors.
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 Fresh Versions of wp-admin and wp-includes to Your Site
This 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. Backup your site, and download a fresh version of WordPress from the main site.
Extract the files from the ZIP file, and open the extracted folder. Open your site’s root directory in an FTP client, and upload the wp-admin and wp-includes from your fresh version of WordPress to your site’s directory, overwriting the older versions.
Refresh the 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 Your Host
If you’ve gone through all of these steps and still cannot find a solution, your host may have it. It is, 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.
The 500 internal server error is a frustrating issue as it doesn’t always have a clear cause or a clear solution. It requires a lot of troubleshooting, as you’ve learned, but I hope these steps have at least made the task a little less irritating.
All in all, make sure you back up your site on a regular basis and update your plugins, themes, and WordPress core files as soon as they’re available. A great way to prevent this issue is to ask your theme’s developer whether or not their theme or an update to their theme is compatible with the plugins you’re running on your site as this may corrupt your .htaccess file.
Lastly, make sure you upgrade your hosting package accordingly. This error is most likely to occur on a small-budget shared hosting server, so it’s important for you to begin researching other options so you can move your site to a server capable of handling your growing site.
Have you ever had this issue? Share your experience in the comments!
Article thumbnail image by Fireofheart / shutterstock.com