How to Fix HTTP 500 Internal Server Error in WordPress

in #wordpress4 years ago (edited)

How to Fix HTTP 500 Internal Server Error in WordPress

Are you frustrated trying to fix the HTTP 500 Internal Server Error on your WordPress site?

You’re not alone. This is one of the most dreaded errors on WordPress because it never has a straightforward solution.

Troubleshooting can take a lot of time and meanwhile, your site is down. You lose visitors, traffic, SEO rankings, and revenue.

But don’t worry. We’ve encountered this error on our site too. Plus, we’ve seen many of our clients go through the same ordeal.

In this guide, we show you the steps you can take to successfully solve the HTTP 500 error fast.

TL;DR –
The HTTP 500 error has various causes and solutions. If you’re facing this issue and need to fix it immediately, skip ahead to How To Solve the HTTP 500 Internal Server Error. We recommend coming back later to understand this error so that you can be better prepared the next time it happens.

Table of Content

What Is The WordPress HTTP 500 Server Error?

The HTTP 500 Server Error, commonly known as Internal Server Error, can happen to any website that’s running on a web server, not just WordPress sites. The HTTP 500 Server Errors can occur repeatedly. Fixing it one time doesn’t mean you won’t face it again. So it’s advisable to understand what it is and why it happens.

To understand this error, you need to know how HTTP requests work. When you visit a website, your browser (such as Google Chrome or Mozilla Firefox) sends a request to the website’s server.

The server processes this request, fetches the necessary information, and sends it back to the browser. The browser then displays the content of the website to you.

Now, when the server sends back the data to the browser, it includes an HTTP header with a status code. This code tells you what is the status of your request.

  • HTTP 200 means the request is all right.
  • HTTP 500 means there is an error as something has gone wrong.

HTTP Error 502

There are various kinds of 500 errors and they each have different causes. We discuss the possible causes next.

Why Are You Seeing The WordPress HTTP 500 Server Error?

To run your website, there are a number of devices working and communicating with each other such as servers, operating systems, and browsers. So, unfortunately, there are a number of causes and it’s difficult to pinpoint exactly where things have gone wrong.

HTTP 500 error example social media

We’ve analyzed over 240,000 WordPress sites, and these are the predominant reasons we’ve found to be the root cause of the error:

  1. Corrupt .htaccess file
  2. Exhausted PHP Memory limit
  3. Corrupted or Incompatible plugin
  4. Corrupted or Incompatible theme
  5. Incompatible PHP version
  6. Corrupted WordPress core files
  7. Incorrect file permissions

We’ll discuss these causes along with their solution in detail next. We understand that since the probable causes and solutions are aplenty, this guide may seem overwhelming. So we’ve detailed the easiest solutions first and if that doesn’t work, you can move on to the more technical ones.

Steps To Take Before You Fix The WordPress HTTP 500 Server Error

Troubleshooting the HTTP 500 Error can take time. Meanwhile, your visitors will see an error or a blank website. We show you the best way to deal with an HTTP 500 Error by getting your site back online and then troubleshooting:

Step 1: Check If Your Website Is Actually Down

Sometimes, it’s possible that you are seeing the HTTP 500 Error on your browser but the site probably looks fine for everyone else. There’s a handy site to check if the error is showing only for you – downforeveryoneorjustme.com.

Down For Everyone or Just Me

Enter your website’s name or the URL you want to check. It will check the HTTP status code that is returned from the server.

Step 2: Refresh The Page

This may seem too basic, but in many cases refreshing the page actually works. You can refresh your browser using F5 or CTRL+F5.

The reason you may have been experiencing the error is because sometimes your web host’s server may have been temporarily overloaded. It may resolve on its own and will display a working website when you refresh your page.

Step 3: Clear Your Cache

Before you troubleshoot, it’s best to clear your cache. A cache stores your website’s data in order to reduce the loading time.

You can clear your browser cache using the Settings option on your browser. For Google Chrome, you’ll find it under Settings > Browsing History > Clear Browsing Data.

Clear browsing data

To clear your website’s server cache, you can use any one of the Caching Plugins available in the repository.

Clearing your cache ensures you are viewing the latest data. So when you troubleshoot the issue, you won’t be seeing redundant data.

Step 4: Restore your backup

If you’ve backed up your website using a plugin or your web host, the first step we recommend is to restore your backup. From our experience, restoring a backup works around 90% of the time.

You can get your site back online so that visitors see a working website. Once that’s done, you can take your time in troubleshooting the error.

If you don’t have a backup, we strongly suggest you take one now. You can use our BlogVault plugin to take an automated backup in under a few minutes. The plugin will also come in handy in the next step.

Step 5: Create a staging site

A staging site is a clone of your live website that you can use to run tests and experiment with changes such as a new theme or plugin.

Anything you do on this site doesn’t affect your live site so it’s an ideal solution to troubleshoot safely without worrying about causing further damage to your site. We recommend using a staging site to find the root cause of the problem especially if you’re seeing the HTTP 500 Error repeatedly on your site.

You can create a staging site easily using our BlogVault plugin. Simply activate the plugin on your site and it will automatically take a backup for you. Once complete, from the BlogVault dashboard, you can create a staging site in one click.

blogvault add staging

Alternatively, you can check with your web host if they provide staging or you can use one of the many staging plugins available.

Once your staging site is set up, you can begin to troubleshoot the error. Let’s begin.

How To Fix The WordPress HTTP 500 Server Error

To fix the Internal Server Error on your WordPress site, there are a couple of easy steps and some highly-technical ones.

Note: If the error occurred following an action you took like an update, then you can trace the root of the problem to the update. However, if the error is occurring randomly, then you need to follow the steps below to figure out what’s happening and how to fix it.

We’ll start with the easiest steps you can try first, if that doesn’t work, you can progress down the list. In case you’ve already tried a bunch of these steps, you can pick the steps you want to try:

1. Check Your Activity Log

If you have an audit or activity log on your site, this is your first point of troubleshooting. An activity log keeps a record of all activity on your site.

This log will help you identify what changes were made recently. If you don’t have an audit log on your site, you can check with your web host if they can provide you with a server log.

Activity log viewer

You can quickly narrow down the root cause of the HTTP 500 error.

2. Check If There Are Updates Available

Many times the HTTP 500 Error is caused by incompatibility issues or outdated software. Say you updated the core to a new version. This may have caused a plugin to become incompatible to the core which caused the errors.

If you see updates available on your site, run the update. We strongly recommend testing the update on the staging site you created.

Update Now on dashboard

If the updates resolve the problem, you can update your live site.

3. Switch To A Default Theme

Many times, an error in a theme or child theme may be causing the HTTP 500 Error. Try deactivating your theme and activating one of WordPress’ default themes like the Twenty-Twenty theme.

Activate default theme

If this resolves your issue, you know that the theme you’re using is causing the issue. You will need to contact the theme’s developer to find out the exact problem. They will most likely fix the bug and your theme will work fine once you update it.

4. Check Your Plugins

Plugins are one of the most common causes of the HTTP 500 Internal Server Error. A recently installed plugin may be causing the error.

If you have access to wp-admin, go to Plugins, select all the plugins, and then Deactivate them.

Deactivate plugins on wp dashboard

If you don’t have access to wp-admin, you’ll need to disable plugins manually:

  • Go to your web host account and access cPanel > File Manager.
  • Open the public_html folder and go to wp-contents.
  • Find the folder called Plugins and rename it to Plugins_Disable.

Once you disable your plugins, clear your cache and refresh your website page. If the HTTP 500 error is gone, you can be sure it’s a plugin that’s causing the issue.

Now you can activate plugin one or two at a time and keep reloading your site to check which plugin is causing the problem.

If you manually disabled your plugins, you would need to rename the folder back to Plugins. Next, rename each plugin folder inside with the suffix _disable.

After, you can rename each plugin folder back to its original name to detect which plugin is causing the issue.

5. Check Your .htaccess File

One of the most common reasons for the HTTP 500 Server Error is a corrupted .htaccess file. To resolve the issue, you need to rename the .htaccess file to disable it.

Access cPanel > File Manager > public_html. Here, search for the .htaccess file. If you cannot see it, click on Settings. Select Show Hidden Files (dotfiles).

Show hidden files .htaccess

Save and exit this window. You should see the .htaccess file now.

Now rename the .htaccess file to .htaccess_disable.

To rename the .htaccess file, you will need to login to your site using FTP or File Manager app in your hosting account’s cPanel dashboard.

Once connected, the .htaccess file will be located in the same directory where you will see folders like wp-content, wp-admin, and wp-includes.

htaccess and index php files

Now visit your WordPress site to see if the HTTP 500 Error is gone. If it did, there’s one more step you need to take.

Go to your wp-admin panel > Settings > Permalinks. Here, just click the save button without making any changes. This action will create a fresh .htaccess file.

6. Check File Permissions

This is not so common, but it happens on occasion that incorrect file permissions cause the HTTP 500 Error.

File permissions grant access to read, write, and execute files on your site. You can learn more about WordPress File Permissions here.

WP file permission

We recommend permissions be set to the following:

  • wp-admin: 744
  • wp-content: 744
    • wp-content/themes: 744
    • wp-content/plugins: 744
    • wp-content/uploads: 744
  • wp-config.php: 764
  • .htaccess: 764

You can also refer to WordPress recommended File Permissions.

To check and set the file permissions, you can use cPanel > File Manager in your web hosting account.

Permissions in cpanel

Once the correct permissions are in place, it might resolve the HTTP 500 Error. If it doesn’t, we still have a few more steps to go.

**7. Check PHP Version **

PHP is a programming language that powers most of the things you see on your website – both on the front end and the back end. Just like WordPress receives updates, PHP also gets updates on a regular basis.

Your website should be running on the latest PHP version available.

To find out which version of PHP your site is using, log in to your web hosting account. Go to cPanel > phpMyAdmin.

You can view the PHP version of your WordPress site here, like so:

PHP version in phpmyadmin

If you’re running an old version of PHP, updating it can resolve the error. We’ve detailed How to Update the PHP Version on WordPress.

8. Increase Your PHP Memory Limit

Every website is granted a limited amount of PHP memory. If you exceed the limit, you will see the 500 Internal Server Error.

Fortunately, you can increase the PHP limit quite easily. You need to edit your wp-config.php file for this. Follow our guide on how to increase your PHP limit through wp-config file.

You can access your wp-config file through cPanel > File Manager > public_html. Right-click and edit this file.

To edit the memory limit, find this line of code:

define(‘WP_MEMORY_LIMIT’, ’32M’);

A PHP memory limit of 128M should be more than enough. So, increase the limit from 32M to 128M using the following line of code:

define(‘WP_MEMORY_LIMIT’, ‘128M’);

Remember to save the file and don’t go overboard with this limit or you may end up crashing your server.

9. Reinstall WordPress

If none of these steps worked, we recommend reinstalling WordPress. Sometimes, files in the WordPress core installation get corrupted, especially if you’ve been running your website for many years.

Reinstalling WordPress may seem worrisome because you’ll be replacing core files. But there are ways to do this without any stress. Here’s an in-depth guide to reinstalling WordPress.

CAUTION: This step carries a certain amount of risk. Ensure you backup your site and reinstall WordPress on a staging site first. Once you’re sure it works, you can replicate the changes on your live site. If you’re using BlogVault to backup and stage your site, you can use the Push To Live feature to automatically replicate the changes on your live site.

What To Do If You Can’t Fix The HTTP 500 Internal Server Error

Unfortunately, the HTTP 500 Server Error is a difficult one, so there are rare chances that the error is still unresolved even after taking all these measures.

Here’s what you can do if the error is still present on your website:

  1. Contact your web host – It may be a server issue which only your web host can resolve. Connect with the customer support of your web host and give them details of the different methods you tried so far. Request them to check if it’s an issue on their end.

  2. Ask for help on the WordPress Support Forum – WordPress has a very supportive community that is ever ready to help out their fellow WordPress users. You can post the issue you’re facing on the WordPress Support Forum. You should get a response in no time.

  3. Check popular forums – You can also check popular forums like Quora, Reddit, and StackOverflow to see what solutions have been provided for the HTTP 500 Error.

The HTTP 500 Error can be a frustrating one because it can take so long to troubleshoot and resolve. Thankfully, it’s not a permanent issue and can be fixed by troubleshooting properly, identifying the issue, and resolving it as soon as possible.

What Next?

While there are many issues that can prop up while running a WordPress site, the HTTP 500 Error is a dreaded one. In some cases, fixing it is as easy as refreshing your browser. But in other cases, nothing works!

Plus, resolving the error doesn’t mean it won’t happen again. So it’s best to be prepared and know what to do when you’re faced with this issue:

  1. Always backup your website so that you have a copy of your site that you can restore. This minimizes downtime.

  2. Create a staging site and use it to troubleshoot the problem.

  3. Bookmark this article and keep it handy so that you have a checklist of measures to take to resolve the error fast.

If one of the steps mentioned above helped you resolve the HTTP 500 Internal Server Error, leave a comment below. I'd love to hear from you.

Source: BlogVault

#wordpress #websitedesign #websitedevelopment #webdesign #webdevelopment
#howto #fix #http #internalservererror #internalserver #servererror #server #error