The way your site functions depends on a lot of factors, so things might go wrong from time to time. But worry not, there's always a fix! In this article we'll look into the HTTP error 500, it's possible causes and ways to resolve them.
Even if you haven't experienced this error, a good scout is always prepared.
Note: Don't forget to back up your site before trying any of the fixes, so you won't have other issues if something goes wrong!
How can I recognize a 500 error?
If you haven't come across this error before, the text you see might differ. Of course, the “error 500” part is the main thing to recognize. But these are some of the names this error might be hiding behind:
- HTTP error 500;
- 500 internal server error;
- HTTP internal server error;
- Internal server error.
So in short, keep an eye out for “500” and “internal server”.
What is 500 Internal Server Error?
The HTTP 500 error is a general server error. The thing about this error is that it doesn't tell you right away what is causing it like some other 5xx errors do. You know that a page isn't working and that there's a server issue, but not exactly what it is.
The 5xx errors are the following:
- 500 Internal Server Error;
- 501 Not Implemented;
- 502 Bad Gateway;
- 503 Service Unavailable;
- 504 Gateway Timeout;
- 505 HTTP Version Not Supported;
- 506 Variant Also Negotiates;
- 507 Insufficient Storage;
- 508 Loop Detected;
- 510 Not Extended;
- 511 Network Authentication Required;
- 599 Network Connect Timeout Error.
The 500 error is not WordPress specific, so it might take some troubleshooting to get to the fix. That is exactly what we're going to do here.
What can cause an HTTP 500 error and how to fix it
Once you've faced this error, it's time to get to work and start looking for what caused it. I'll go through the most common causes of the error, how to find what caused the HTTP 500 error for you and fixes to try.
This might seem too obvious, but the first step is just to refresh the page. The server might be experiencing some temporary issues, that refreshing fixes. If not, jump into the serious investigating part.
Note: Don't forget to refresh and check after every fix you try, so you can be sure, what is causing the error to appear.
It's possible that a plugin is causing this error. It might be a new version that causes conflict, a faulty installation, incompatibilities, etc.
The way to check if this is the issue is to deactivate all plugins and check if the error has disappeared. If it has, you've found what caused it. Now activate the plugins one by one to find which one is causing the error.
If by any chance you can't access your WordPress admin panel, you can log into your FTP account or the file management area of your hostings control panel. There, locate the wp-content folder and it will have the Plugins folder as well as Themes folder and others. Here you can rename the Plugins folder to anything else - Plugins-off for example. That will deactivate all plugins on your site. So again, refresh to check. If the error is gone - one of the plugins is responsible.
Note: If you've tried this step, don't forget to set the folder back to the original name!
Corrupted .htaccess file
To check is the .htaccess file is corrupted, you'll again have to log in to your FTP account or the file management area of your hostings control panel. There you'll be able to locate the .htaccess file. If it is causing the error, the fix will be to replace it.
To check if it's the cause of the error, simply rename the file to .htaccess-test for example and reload your site to see if it fixed the issue. If it has, we know that that's what we have to work with.
Now, to generate a new .htaccess file, go to your WordPress dashboard, locate the Settings and go to the Permalinks section. Now scroll to the bottom and save the settings. That should have fixed the issue.
Exceeded PHP memory limit
The other issue that might be causing the 500 internal server error is that you could be reaching the PHP memory limit. In this case, you'll have to increase it and I'll tell you how to do that.
Once again, you'll have to log in to your FTP account or the file management area of your hostings control panel. There you'll need to edit the wp-config.php file. To do that, download the file by right-clicking on it and then - download. Now open the file in a text editor and add this piece of code under the PHP opening tag.
define( 'WP_MEMORY_LIMIT', '256M' );
This will increase the memory limit to 256MB.
Now save the file and upload it to the root directory, overwriting the original file. At this point, check if it fixed the error. If it has - great. If not - you'll have to change everything back as it was before and look for another cause.
Note: If this fix has worked, it would be advised to contact your hosting provider in order to increase the PHM memory limit manually from their side, as this fix doesn't tell us what caused the memory limit to exceed in the first place.
If nothing works, you can always contact the support team of your hosting provider. They'll be able to give you more specific information about what might be going on as it might be something on their end as well.
Most hosting providers will offer 24/7 support. So make sure to check out the options of your hosting.
Any error can be annoying, especially one that doesn't reveal what caused it right away. But if you know these most common fixes, you should be prepared for any 500 error that comes your way.
And I'll remind you once again - don't forget to back up your site before doing any changes. Finding an error and then breaking your site trying to fix it would be one of the worst ways to spend your day.