You’ve broken your website again, haven’t you? The dreaded 500 Internal Server Error is one of the most common “omg I’ve broken everything” type errors in WordPress. This can be an incredibly annoying error to experience and the cause of site downtime you just can’t afford. So, what can you do about it?
We’re about to take a look at what this error means, the most common reasons it can occur, and quick troubleshooting steps to correct each scenario. If you’re getting a 500 error, try each of these steps before contacting your host. Doing so may fix your problem, and if not then at the very least you’ll already have some information to go on when you do reach out to your host.
What is a 500 Internal Server Error?
It’s a catch-all bucket error. It’s basically you responding to your doctor “I hurt” when he asks what’s wrong with you. Except in this case, it’s the web server hosting the page you’re trying to connect to having a breakdown.
Normally when you request a webpage the process goes a little something like this:
- You type the page URL into your browser and hit enter. [go browser go!]
- Your browser sends a request for that page to the server that hosts it. [I can has page please?]
- The web server hosting the page locates that page. [sure let me grab that for you.]
- The web server transmits the HTML file for that page to the browser. [here, have my pages!]
- The browser displays the page. [good browser!]
The 500 error occurs when something goes wrong in Step 3. Instead of the web server responding “sure let me grab that for you” and then locating the page, the web server says something along the lines of “mirfrogansnogalanfragnenstein aaaaaaaaaahhhhhhhh, kerplunk”. Which tells you absolutely nothing other than something has gone horribly wrong. To make everything more confusing, this can happen for a variety of different reasons. So, how to start troubleshooting?
Troubleshooting the 500 Internal Server Error
Checking Theme and Plugins
Renegade themes and plugins are the most likely cause of your 500 internal server error. Unfortunately figuring out which one it is is a bit of a pain. There’s no simple test to run that will identify the culprit.
What you’ll have to do here is simple process of elimination. Change over to a default WordPress theme like Twenty Sixteen and deactivate all plugins. If the 500 errors stop, you know there’s a bad apple. Re-enable your theme. Test. Reactivate one plugin. Test. Reactivate one more plugin. Test. Keep on keeping on until your test springs the error, and you now know who the delinquent is. Case closed (hopefully). If not, read on.
Corrupted .htaccess File
Corrupted .htaccess files are less common than a renegade plugin, but are still a fairly common cause of the 500 internal server error. The .htaccess file is located in the root WordPress installation directory alongside the wp-admin, wp-content, and wp-includes folders.
Access your WordPress installation via cPanel or FTP
Locate the .htaccess file. It is sometimes hidden; if that’s the case you’ll need to enable show hidden files.
Rename the .htaccess file to something like .htaccess_test or .htaccess_old
Navigate to Settings>Permalinks
Save. This will generate a new copy of .htaccess
If the 500 error was due to a corrupt .htaccess file, replacing it in this manner should solve your problem. If it doesn’t, continue troubleshooting below.
PHP Memory Limit
Reaching or exceeding the PHP memory limit will cause the 500 internal server error. There are two ways you can go about addressing this.
For 500 errors that are occurring on the WordPress admin:
Locate php.ini inside the wp-admin folder of your WordPress installation. If there’s not one, create a blank text file and name it php.ini
Find or paste in the line memory=xMB. If there is already a php.ini folder in your installation, x will be one of a series of numbers: 32, 64, 128, 256, 512
If you already have a php.ini and x is already a number, double it. If you’ve created your own php.ini, change x to 128 or 256. The resulting line should then read memory=128MB or memory=256MB
Save and exit the file. If you’ve had to create your own php.ini, upload it to the wp-admin folder via FTP
For 500 errors that are not limited to the WordPress admin:
Locate wp-config.php in your root WordPress directory
Add the following line inside the main php tag:
If this works, then consider it a patch. A temporary patch. Something in your WordPress installation is hogging memory, and will probably eventually reach the new ceiling you’ve set. You’ll need to identify the underlying problem before you run out of space to raise the ceiling. Most hosts will cap the number you can raise the memory limit to.
Corrupted Core File
There’s a million reasons it can happen and it’s not all that common, but occasionally a core WordPress file can turn to the dark side. Uploading a fresh set of core files can solve your 500 internal server error.
Log in to your site via FTP and copy in a fresh wp-admin and wp-includes folder. Changing these won’t affect the customization work you’ve done to your site unless you’ve expressly customized files inside these folders, which is not a typical thing to be doing. The files inside wp-content are where your theme, plugins, and other changes you’ve made to your site are housed. Do not upload a fresh wp-content or you will wipe your site.
Contact Your Host
If you’ve exhausted these steps and are still getting the 500 internal server error, it’s time to enlist aid. Chances are it’s something happening on the host’s end, or at the very least something you’ll need their guidance on. Hopefully you’re not reading this because one of the above steps worked for you!
Finding the cause of the 500 error can be one of the most frustrating experiences you run into. It’s such a general error it can drive you mad narrowing it down. This isn’t an exhaustive list of things to try. These are just solutions for the most probable problems. So, don’t fret if this hasn’t worked for you. Get a hold of your host and, if you have a good one, you ought to be able to work with them to identify the problem pretty quickly. Good luck and hope this has helped!
Shafi Khan says
Thanks a ton. It saved my website.