As marketers, we love high numbers. 500 post views? 500 new leads today? Awesome!

But, sometimes high numbers aren’t so great. The last thing any website owner wants to see when opening their homepage is this:

screenshot of a 500 internal server error message

When you get a 500 Internal Server Error on your WordPress website, it brings your entire operation to a standstill and leaves you rushing to find a solution.

The good news is that you’re not the first one to have this problem in WordPress, and, with a bit of tweaking, there’s usually an easy solution. In this article, I’ll show you why this error is showing up on your site and how to get rid of it. Let’s get started.

Grow Your Business With HubSpot's Tools for WordPress Websites

HTTP Error 500 in WordPress

When you visit a website, your browser makes a request to a web host, asking to send you a specific web page. If something is wrong with your website that keeps the hosting server from delivering that page to your browser, it will instead send you an error message. This is a 500 Internal Server Error.

A 500 error can be caused by many different things, but it’s probably not an issue with the host server itself. Rather, the host likely can’t get the contents of your site for some reason.

With WordPress sites, the most common causes of a 500 Internal Server Error are:

  • faulty plugins or themes
  • a broken .htaccess file, and/or
  • the PHP memory limit being exceeded.

Occasionally, the issue might come from your hosting server. The vagueness of a 500 makes it pesky to resolve. The good news is that trying a few repairs will almost certainly solve your problem

1. Back up your website.

Fixing your issue will require changing some things around on your site, including messing around with your plugins, themes, and possible core files. Even though your site is down, make a backup of your files in case you lose data and need to backtrack.

Save your backup in a safe location. Hopefully, you won’t need it.

2. Enable the WordPress debugging feature.

WordPress includes a handy debugger to help you troubleshoot. When something goes wrong, the error log will report the specifics of the problem. It’s disabled by default — first enable it with the steps below:

1. Access your website via SFTP.

2. Open your public_html folder.

3. Locate and right-click the wp-config.php file, then choose the View/Edit option.

4. Scroll to the bottom of the file and paste the following line of code:

 

define( 'WP_DEBUG', true );

This code tells WordPress to log errors on your website.

5. Save your changes and reload your website. You might see a more detailed error report that identifies the source of the issue — this could point to a specific plugin or file. If it’s still unclear, keep reading.

Once you’re finished using the debugger, remember to disable it by removing the code you added above and saving the file, being careful not to change anything else!

3. Deactivate your plugins.

A likely cause of this error is that one of your plugins (or a combination of plugins) is causing your backend to malfunction. The best way to test this is by deactivating all your plugins, then narrowing down to the culprit.

If you can access the administrator account, try the following:

1. From your Administrator dashboard, select Plugins > Installed Plugins.

2. Check the box next to Plugin to select all your plugins.

3. Choose Deactivate from the Bulk Actions drop-down, then click Apply.

4. Refresh your site. If you no longer see the error, start activating each plugin one by one and reloading your site after each activation to identify the faulty plugin.

If you don’t have access to the administrator controls, you will need to connect to your server using a secure file transfer protocol (SFTP). After connecting, you’ll see all your files for your WordPress website. Follow these steps:

1. Open the public_html folder, then open the wp-content folder.

2. Rename your plugins folder “plugins_old”.

3. Refresh your website. If your site works, rename your plugins_old folder back to “plugins”.

4. Within that the plugins folder, rename each plugin folder one at a time until you find the plugin that causes the bug.

If you find a specific plugin causing the error, replace the plugin, or notify the plugin developer.

4. Disable your currently active theme.

If plugins aren’t the issue, your theme might be, especially if it comes from a third-party developer. To check this, start by temporarily replacing your current theme with a default WordPress theme. If you can access to administrator controls, follow these steps:

1. Select Appearance > Themes from the WordPress dashboard.

2. Activate any default WordPress theme, such as Twenty Nineteen.

activate theme screen to resolve the HTTP 500 error in WordPress
3. Check your website for the error message.

If you can’t get into your admin, you’ll need to open your SFTP to access the website. Then, do the following:

1. Open the public_html folder, then open the wp-content folder.

2. Open the themes folder and look for your active theme folder.

3. Add “_old” to the end of the name of your active theme folder. This disables the theme.

4. Refresh your website. If it works, you’ve found the problem. Contact the theme developer about the error and ask for the latest version of the theme.

5. Check your .htaccess file.

The next likely cause of a 500 Internal Server Error in WordPress is a corrupted .htaccess file, located in the root directory of your website files. This file contains various directions for your host server to follow, like allowing password-protection for web pages and redirecting URLs.

Like other source files, any typo or incorrect modification in .htaccess will break the code and potentially your site. Follow these steps to make sure it’s working:

1. Connect to your server with SFTP or your cPanel dashboard.

2. Navigate to your site’s root directory — if you see the wp-admin and wp-content folders, you’re in the right place.

3. Find the .htaccess file (keep in mind your server might hide this file by default, in which case change the view settings). Rename this file to something like .htaccess_test.

4. Refresh your website. If you no longer see the error, this means .htaccess is the source of the issue. If you still see a 500, skip to the next step.

5. To repair .htaccess, you just need to replace it with a new one. From your WordPress dashboard, select Settings > Permalinks.

6. Click the Save Changes button at the bottom of the page.

6. Check your PHP memory limit.

Your site’s PHP memory limit is allotted by your WordPress installation and by your host. If your site exceeds its memory capacity, a 500 Internal Server Error will result. To increase your memory limit, try these steps:

1. Connect to your server with SFTP or your cPanel dashboard.

2. Navigate to your site’s root directory and find the file wp-config.php. This file contains the rule that determines your memory limit. Make a copy of this file as a backup.

3. Open wp-config.php and search for the code “WP_MEMORY_LIMIT.” If you find it, replace the value in this rule with “64M”. If not, paste this line of code at the bottom of the file:

 

define('WP_MEMORY_LIMIT', '64M')

4. Refresh your website. If the error is gone, you’ve found the issue.

If you’ve exceeded the memory limit, you now need to determine why. It’s possible your site has grown too large, and you need to upgrade your hosting plan to accommodate your storage needs.

However, another potential cause is a plugin or theme depleting your memory. Contact your hosting provider and request a report of resource usage (or find this information yourself if your host has it accessible).

7. Replace your WordPress core files.

In some instances, your WordPress core files could have been improperly modified by a plugin or theme. If you’ve gotten this far with no fix, it might be worth it to swap out your current core files with clean, unmodified ones. While you’ll still have your site data after this change, you might need to re-toggle some original settings.

To replace WordPress core:

1. Download WordPress and unzip it on your device.

2. In the main wordpress folder, delete wp-config-sample.php and the wp-content folder. If you don’t delete these files, they’ll overwrite your current site data.

3. Use your SFTP transfer tool to place the new WordPress core files on your hosting server and replace the current files.

If All Else Fails...

As a last resort, reach out to your hosting provider support — the problem may actually be on your server in this case. Explain the troubleshooting you’ve already conducted, and they’ll review your server configuration and logs to track down the cause. It’s in situations like this where quality customer service from your hosting provider really shines through.

Internal Server Errors are so frustrating because they’re so ambiguous and misleading. Still, by following the steps above, you’ll probably come out of it with minimal impact to your WordPress website and reputation.

One more note: Be cautious about these types of errors when changing your website. We highly recommend testing out your new themes, plugins, and updates in a staging site. This way, if you get a 500, your visitors won’t see it on your actual website.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

 Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Jul 16, 2020 7:00:00 AM, updated July 16 2020

Topics:

WordPress Website