The 500 Internal Server Error: Why It Happens, and How to Fix It in WordPress

The 500 Internal Server Error: Why It Happens, and How to Fix It in WordPress

In a previous post, we looked at how to combat the dreaded White Screen of Death (WSoD) – but that’s not the only error that can ravage your WordPress website and leave you tearing your hair out. The 500 Internal Server error is just as damaging (and potentially confusing) to fix.

With the WSoD we had nothing at all to go on, but with this error we at least have its name – and just like the WSoD, there’s a logical process you can go through to put it in its place.

In this post, we’ll look at how to diagnose and fix the error by running through five logical steps to get your site back online. Firstly though, let’s look at what the error is, and its cause.

What Causes the 500 Internal Server Error?

While it may seem confusing on the surface, the 500 Internal Server error is simply your site’s equivalent of telling a doctor “I’m sick”. There are many potential causes, but you’ll usually find that the error is down to one of the following three reasons:

  • Corrupted files or folders.

  • A low memory limit set by your hosting company.
  • Incompatibility between a theme and a plugin, or between plugins.

Now we know the likely causes, we can begin to formulate a plan to banish the 500 Internal Server error for good. Let’s take a look!

5 Steps to Fix the 500 Internal Server Error on Your WordPress Website

While there are five steps outlined below, you may not need to carry out every one. You can tackle them in any order you choose – we’ve just presented them from most to least likely – so feel free to go ‘off-piste’ if you suspect a certain reason for the error.

Also, before you begin to carry out these steps, make sure your website is backed up, and you’re up to speed on using a File Transfer Protocol (FTP) manager (don’t worry, they’re not as scary as you think). Throughout this post, we’ll be using FileZilla – which is free and open-source – although other solutions are available.

With the above housekeeping out of the way, let’s now take a look at the five steps.

Step 1: Modify Your Memory Limit

Simply put, memory is allocated by your hosting provider to various parts of your WordPress installation, and if it’s too low it can potentially cause the 500 Internal Server error. Note that some hosts don’t provide options for you to adjust your memory within your hosting panel, so you may have to contact them directly to complete this step.

To start, open your FTP manager, connect to your server using the credentials found within your host’s admin panel, and click Quickconnect:

Logging into your FTP manager.

Your files and folders are displayed on the right-hand side. Navigate to your ‘home’ folder (likely called public_html or www), find the wp-config.php file, then right-click and select View/Edit, choosing the default text editor if prompted:

The config menu with View/Edit highlighted.

Once open, type the following code into the file on the next line after the opening <?php

Copy to Clipboard

This allocates more memory to your WordPress installation, so save the file and navigate to your site to check if it’s back online. If not, move onto the next step.

Step 2: Check Your .htaccess File for Corrupt Data

Your .htaccess file is a configuration file for your website’s host server, and it can be easily corrupted by any number of site changes. Fortunately, it’s also easy to troubleshoot.

Firstly, navigate to your home folder using your FTP manager, and look for the .htaccess file. If you don’t see it, you’ll need to select Server > Force showing hidden files in your FTP manager’s toolbar:

Showing hidden files using FileZilla.

Once you’ve found it, right-click and rename it to .htaccess.bak:

Renaming the .htaccess file.

This effectively removes the file from your WordPress installation, so we’ll need to create a new one. Head to your WordPress dashboard, and navigate to Settings > Permalinks

The Permalinks tab in the WordPress dashboard.

Scroll down to the bottom of the page and click Save Changes. Doing this will trigger WordPress to create a new .htaccess file.

Now check out your site. If you’re still getting the error, let’s move on!

Step 3: Check for Incompatible Themes and Plugins

Plugins and themes go hand in hand with WordPress, but they can also be the cause of the 500 Internal Server error. That being said, the process you take to troubleshoot them depends on whether you can access your WordPress dashboard. If you can’t, you’ll need to troubleshoot your themes and plugins via FTP – our previous article on the White Screen of Death has the full instructions to do that. However, if you can access your dashboard, it makes your job a little easier.

Firstly, navigate to Plugins > Installed Plugins, where you’ll see the list of plugins you currently have installed. Here, click the checkbox underneath the Bulk Actions drop-down to select every plugin, choose Deactivate from the drop-down, then click Apply to deactivate them all:

The Bulk Actions drop-down.

Check your site again, and if the error has disappeared, a plugin was the cause. At this point, activate each plugin one at a time and check your site until you root out the troublemaker.

If the problem plugin is vital to your workflow, you have a few options. You could try updating to the latest version, reaching out to the developer in question for advice, or finding an alternative. If the plugin isn’t vital, we advise you simply delete it.

If you still have the error having checked your plugins, you’ll need to check your themes. Navigate to Appearance > Themes, and activate a default WordPress theme, such as Twenty Sixteen:

The Activate button in Twenty Sixteen.

Check your site again, and if the error has gone, your current theme was at fault. As with plugins, you could try updating the theme or contacting the developer for advice – but if that was fruitless, you’ll likely need a new theme. The Avada WordPress theme is our first choice (naturally!), and comes with regular updates and high quality support.

Step 4: Upload Fresh Core WordPress Folders

Files and folders can easily become corrupted from the numerous data transfers that take place when running WordPress, but fortunately, they’re easily fixed. First of all, download a fresh copy of WordPress, and extract the resulting ZIP file into its uncompressed form:

An extracted ZIP file.

From here, open your FTP manager and connect to your server. Navigate to your website’s root folder on the right hand side, and from the left, locate your fresh WordPress folder on your computer:

The home folder and local computer files within FileZilla.

Right-click the wp-admin and wp-includes folders, select Upload, and wait for the files to transfer across. Once complete, check your site again. If you’re still experiencing the error, move onto the next step.

Step 5: Check Your File Permissions

Finally, your WordPress file permissions may be set incorrectly – and while rare, this has been known to cause the error. While getting in-depth on file permissions is outside the scope of this post, we can at least show you how files and folders are meant to look.

Firstly, you can view permissions by right-clicking File permissions… on any file or folder within your FTP manager:

Accessing file permissions from the right-click menu.

You’ll notice a three-digit number, which represents the permission in question. Folders should look like this…

…and files should look like this:

An example of correct file permissions.

It’s worth mentioning that if you’re uncomfortable with carrying out file permission checks (understandable given the work involved), you might want skip this step and read our final section.

What to Do if You Can’t Fix the 500 Internal Server Error

If all else fails, there’s little else you can personally do. If clearing your browser’s cache doesn’t solve the error, you’ll need to contact your hosting provider’s support team for assistance. If they’re trusted and reliable, they’ll get you back up and running in no time.

You may also want to turn on debug mode, so that your hosting provider has as much to go on as possible, and clearly state the steps you’ve already taken. After all, the quicker you can resolve the error, the faster you’re back online.

Conclusion

Much like the White Screen of Death discussed previously, the 500 Internal Server error can play havoc with your sanity and have you waving the white flag in defeat if you don’t know how to fix it.

However, with our guide and a few logical steps, you’ll be able to send the error back from where it came. Let’s recap the steps you should take:

  • Modify your memory limit.

  • Check for corrupted data in your .htaccess file.
  • Check for incompatible themes and plugins.
  • Upload fresh wp-includes and wp-admin folders.
  • Check the permissions for files and folders.

Image credit: stevepb.

By | 2018-06-10T16:33:42+00:00 June 8th, 2018|WordPress|

Leave A Comment

Recent Posts

Recent Tweets

For privacy reasons Twitter needs your permission to be loaded. For more details, please see our Privacy Policy.
I Accept