Table of Contents
Last update on
The 500 Internal Server Error is arguably the most frustrating error you can experience with WordPress because it can literally mean just about anything. That’s not to say you can’t fix it—you can, and one of the solutions below should help you get your site back up and running.
There are a few common causes, such as having a corrupted .htaccess file, exceeding your PHP memory limit, and having improper file permissions. There are less common causes, too, including issues with your plugins or server.
Unfortunately, there’s no straightforward, 5-minute fix. Solving your 500 internal server error will require troubleshooting that will take time and patience. Typically, fixing this cryptic error will help you determine what actually caused it.
To help you, I’ve put together this troubleshooting guide. Start with the first potential fix—creating a new .htaccess file—and work through each solution before moving onto the next possible fix.
What is a 500 Internal Server Error?
When you visit a site, your browser sends a request to the site’s server. The server processes the request and sends back the resources to display the page, along with an HTTP header, which includes an HTTP status code.
The status code tells your browser the status of the request. For example, a 200 status code means smooth sailing—everything is OK. But if you get a 500 status code, it means something went wrong, and the server isn’t quite sure what went wrong.
Basically, the 500 internal server error code is a generic “catch-all” that means the server encountered an unexpected condition that prevented it from fulfilling the request.
There are several different types of 500 status error codes, which all mean something different, such as 501 Not Implemented, 502 Bad Gateway, 503 Service Unavailable, and 504 Gateway Timeout.
Naming Variations for 500 Internal Server Errors
There are many variations of the 500 internal server error message, depending on the many web servers and browsers available. The website you’re visiting might also have its own custom page for these errors.
Here are several variations of what you might see:
- 500 Internal Server Error
- Internal Server Error
- 500 Internal server error
- Error 500
- HTTP Error 500
- HTTP Error 500 – Internal Server Error
- Temporary Error (500)
No matter which of these (or other variations) you see, they all mean the same thing—something has gone wrong and the server doesn’t know what’s happened.
How to Fix the 500 Internal Server Error
Like I mentioned above, this error indicates that something went wrong, but what the cause is a mystery. With resolving these errors, you essentially need to work backward—find the fix first and then you’ll know what caused the error.
Generally, 500 errors happen due to an issue on the server, but they can also happen due to some kind of client-side issue. So we’ll work through a number of different solutions below that involve both.
Create a Backup First
The fixes below involve tinkering with your site under the hood, i.e. making changes to your site’s root directory. So it’s critical you run a backup.
And if you don’t already have a backup plugin or some other solution in place, it’s high time you got one!
Some of my favorite tools include BackUpWordPress, VaultPress, and BackupBuddy. If you’re interested in database backups, check out WP Migrate DB Pro or simply use WP-CLI to run quick exports.
If you’re with a web host that offers backups, that’s great. But I’d recommend having your own solution that you can quickly access in an emergency without having to go through your host.
1. Check Your .htaccess File
If your site is hosted on a server running Apache, there’s a chance your .htaccess file is corrupted. This can happen after installing plugins or making other changes to your site.
It’s an easy fix. All you need to do is replace your corrupted .htaccess file with a new one.
Usually, all you need to do to create a new .htaccess file is to re-save your permalinks settings in the WordPress dashboard. But if your site is down, it’s likely you can’t log in to your site, ruling out this option.
So you’ll need to use FTP or cPanel to access your site’s files and locate your .htaccess file. For a step-by-step walkthrough on how to do this with FTP and cPanel, check out What is .htaccess and How to Use it With WordPress.
Before you go replacing your old .htaccess file with a new one, create a backup of your name. To do this, simply rename your existing file something like .htaccess-old. WordPress will then stop recognizing this file.
Refresh your site and if it loads properly, you know your .htaccess file has caused the 500 error. Now, revert your .htaccess file to its proper name—the issue will return, but now we’re going to fix it.
For WP Rocket users, you’ll need to be especially careful of what you do next with your .htaccess file because it contains performance optimization rules that you shouldn’t mess around with. So check out Resolve 500 Internal Server Error for what to do next.
If you’re not a WP Rocket user (what’s going on!?), create a new .htaccess file that includes the following, and then upload it to your site’s root directory:
These are the rules shown in the image above:
#BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
#END WordPress
2. Increase PHP Memory limit
The cause of your 500 error could be that you’re hitting your PHP memory limit. This often happens due to poorly-coded plugins, when a site is using a lot of plugins, or when a site is using resource-intensive plugins.
All you need to do to fix this issue is increase the PHP memory limit for your site. There are a few different ways you can do this that involve updating your .htaccess file, php.ini file, or wp-config.php file.
For each of the three memory fixes below, don’t forget to refresh your site to check if it’s working so you know what’s causing your 500 internal server error.
1. Increase PHP Memory Limit in .htaccess File
Find your .htaccess file in the root directory of your site and add the following line:php_value memory_limit 256M
This will increase your memory limit to 256 MB. If you can’t find your .htaccess, make sure you’re able to view hidden files. And if you don’t have an .htaccess file, create a new one and paste in the line above.
2. Increase PHP Memory Limit in php.ini File
You’ll find your php.ini file in the wp-admin folder in your root directory. Open it up and look for the line that starts with “memory_limit.” If it shows 64 MB or lower, replace it with this line:
memory_limit = 256M
If you can’t find your php.ini file (make sure you’ve got “show hidden files” enabled), then you’ll need to create a new file, paste in the line above, name it php.ini and save it to your wp-admin folder.
3. Increase PHP Memory Limit in wp-config.php File
If updating your .htaccess and php.ini files didn’t work, you can try increasing the memory limit in your wp-config.php file.
Add the following line to your wp-config.php file just before the “happy blogging” line:
define('WP_MEMORY_LIMIT', '256M');
Save the file and refresh your site. If it still isn’t working and you have a sneaking suspicion your plugins could be pushing your PHP memory limits, get in touch with your web host about increasing your memory on the server side.
3. Audit Your Plugins
Plugins can also cause 500 internal server errors. This includes outdated plugins causing compatibility issues and even new plugins that have been coded poorly. You might even find that you get the 500 error immediately after installing a new plugin.
To find out which, if any, of your plugins is causing your error, you’ll need to bulk deactivate your plugins and reactivate them one at a time.
If you’re unable to access your WordPress dashboard, FTP into your server and open your wp-content folder, find your plugins folder and rename it something like plugins-old—this will effectively deactivate all of your plugins.
Then refresh your site. If it starts working, the cause of your 500 error is one of your plugins.
The next step is identifying which plugin is the culprit. To do this, rename your plugins folder back to “plugins” and then go into the folder and rename each individual plugin folder, one-by-one until you’re able to refresh your site and it works again.
When you find the offending plugin, get in touch with the plugin developer for help.
4. Check File Permissions
If none of the above has worked, you could have an issue with file permissions. Files in your WordPress directory should be set to 755 or 644 and when they’re mistakenly or accidentally set to anything else it can set off a 500 error.
To check your file permissions, FTP into your server and check your site’s directory. Here, I’m using Filezilla to access my test site and as you can see my permissions are set to 755 for folders and 644 for everything else.
The WordPress Codex recommends the following file permissions:
- All directories should be 755 or 750.
- All files should be 644 or 640. (The exception being wp-config.php, which you can set to 440 or 400 to prevent other users on the server from reading it.)
- Directories should never be set to 777.
If you find that a certain file has the wrong permission, just right-click it in your FTP program to access file permissions and update it to the appropriate number.
Check out How to make system files (.htaccess, wp-config.php) writeable to learn more about updating file permissions.
5. Reinstall WordPress Core Files
It’s not unusual for WordPress core files to become corrupted, especially on older sites that have been customized and updated many times.
To fix this issues, you’ll need to replace your core WordPress files with fresh ones. There’s no need to re-install WordPress—simply download the latest version of WordPress and unzip the file. FTP into your site’s root directory and upload the wp-admin and wp-includes folders from the zip file you just downloaded, overwriting the older versions.
Doing it this way, you won’t overwrite your plugins and themes.
Refresh your site. If the 500 error has disappeared, you’ve pinpointed the cause—corrupted core files.
6. Contact Your Web Host
If you’re still getting the 500 internal server error after working through each of the fixes above, it’s time to contact your web host. Your host’s server logs might be able to shed some light on what’s causing the error so it can be resolved.
Rather than skip the above and go straight to your host for help, it’s a good idea to investigate the cause of your error first. This way, you can provide your host with a rundown of what you’ve tried, so your error isn’t simply dismissed as an issue with your site’s files.
This is particularly true if you’re on cheaper shared hosting. If you’re on managed WordPress hosting, it’s usually the case that your host will help you pinpoint and fix you 500 internal server error.
Wrapping Up
This is by no means an exhaustive list of 500 internal server error fixes. What’s causing your particular issue could be just about anything. But this list will give you a head start on fixing and finding the cause (in that order!).
Lastly, don’t forget to back up your site before updating files in your root directory. If you make a change that impacts your site, you’ll be able to quickly revert to a previous backup.
Have you experienced a 500 internal server error? How did you fix it? Let us know in the comments below!