HTTP 500 Internal Server Error – How to Fix in 2020

What is a HTTP 500 Internal Server Error?

A HTTP 500 Internal server error or in short form called as HTTP 500 error indicate Google’s bot could not access your website URL or the request timed out.

As a result, you’ll see this error message or one of its kind on your browser.

500 Internal Server Error

If your business is entirely dependent on your website, an unresolved HTTP 500 error is a scary situation. Right?

In this guide, let’s see how to resolve this error step by step on a WordPress website.

When you try to load your website or a specific URL of your website on the browser, you might have seen this HTTP 500 error page.

This could happen due to many reasons.

HTTP error code 500 is only a generic error message. Wikipedia lists out specific error codes in the 5xx series with their meaning here.

If server down or overloaded or misconfigured, the system will show the HTTP 500 error.

Try reloading the website with the F5 key or with reload/refresh button or Just open the website in a new browser session after closing all the existing browsers.

If that doesn’t work, just restart the computer, clear the cache and reload the page. 

Use CTRL+SHIFT+DEL on a PC or COMMAND+SHIFT+DEL on a mac to clear browser cache. Or just load the page in a different browser.

If the error is not resolved, wait for a few minutes to see if the error resolves itself.

If this error persists, it could be because of one of many issues. It may be due to issues with the hosting-side or on the client-side. Let’s look at them all and some troubleshooting methods at the client-side.

1. Incorrect Permissions:

Most commonly, setting wrong permissions on a file with scripts may cause the HTTP 500 error. The solution is to reset the permissions. Your hosting provider will do this.

2. Misconfigured Security System:

Google’s bot may be blocked by misconfiguring the firewall or DoS protection system. 

Since Googlebot triggers more requests than humans, a misconfigured firewall may block the Google bot from accessing the site. This will result in a HTTP 500 error.

If you can read and understand the debug.log, which is an error log file, in the wp-content folder, you can easily narrow down the issue. Otherwise, your hosting provider will look into the error log and identify the issue.

3. Database connection Issues:

Error in establishing a database connection can also result in a HTTP 500 error. 

The most common reason is the incorrect login credentials. 

There may be other database related issues like corrupted WordPress database due to repeated installation of many plugins or changing themes or a hacking attempt.

4. Exhausted PHP Limits:

By exhausting PHP limits, a website can trigger 500 server error. There are many ways to increase this limit. 

You can increase the memory limit at the backend of your website via cPanel or using your FTP client. Let’s look at the troubleshooting part later in the post.

5. Wrong .htaccess file:

A syntax error in your .htaccess file or wrong format of this file could also return a 500 internal server error. This file must be in the ANSI or ASCII format, not in Unicode format. 

So write the code in a text editor like notepad++ or notepad or Editplus or sublime editor, not in Microsoft Word.

6. Corrupted .htaccess file:

Your .htaccess file may be in the right format but a plugin you installed may have corrupted it. Even a small error in the .htaccess file can corrupt it. This will result in HTTP 500 internal server error. 

We’ll see how to troubleshoot if the server error was due to a corrupted .htaccess file a bit later in the troubleshooting section of this post.

7. Serving too many dynamic URLs:

The server could also be overloaded or may return a time out due to using a lot of dynamic URLs with multiple parameters. This will result in HTTP 500 error. If you run an eCommerce site, you may know what I mean.

www.website.com/shirts.php?color=green&size=xl

www.website.com/shirts.php?size=xl&color=green

These two URLs would return the same content because they serve the content dynamically. That’s because of how they were accessed. 

Using more of them will take too long for the server to respond and hence the server error. So use dynamically served URLs sparingly.

How to fix a HTTP 500 internal server error

There are a few things you can do at the back end of your site to resolve a HTTP 500 error.
I’ll be showing troubleshooting methods via the cPanel. 

Alternatively, you can do it via a FTP client like File Zilla or WinSCP. 

Please take a backup of your site before doing any of this. 

This will help in case anything goes wrong while troubleshooting.

Step 1. Fixing the HTTP 500 error due to a plugin

The first step is to see if the server error is because of a plugin installed. 

To know this, login to your cPanel and open file manager => public.html => wp-content. 

Here you’ll find the ‘plugins’ folder. Just rename the folder as ‘plugins-test’ or something else. 

This renaming would deactivate all the plugins. Now load the website. 

If the server error doesn’t show up, the error is due to a plugin installed on your site. 

Go ahead and rename the plugin folder back to its original name. 

Now, if you can access the WordPress dashboard, activate the plugins one by one to isolate the culprit. 

If you are not able to access the dashboard, do this at the backend of your website. Go into the plugins folder. 

You’ll find a file for every plugin you installed. 

Just rename them one by one and check if the site is loading to isolate the plugin that’s causing the issue.

Step 2 - Fixing the HTTP 500 error due to PHP memory drain

If step 1 doesn’t solve the problem, go to file manager on your cPanel, => public.html => wp-admin => php.ini. 

If you don’t find the file create a new file using the +File option. Name it as php.ini. 

Open the file with the code editor on the cPanel and type in ‘memory=128MB’. 

Now save it. If the site loads after this step, you’ll need to contact your website host and ask the reasons for the PHP memory drain.

Step 3 - Fixing the error due to corrputed .htaccess file

If step 2 doesn’t solve the problem, go to file manager => public.html. 

You’ll find .htaccess file here. Just rename the file as .htaccess-old. 

Now go back to your browser and load the site. If the server error doesn’t show up, you figured out that the error was due to a corrupted .htaccess file. 

If you can identify the issue within the .htaccess file, you can edit and repair it. 

If you are not able to do it, just delete the file you renamed, which is .htaccess-old. 

Then go back to your WordPress dashboard, settings => permalinks. Don’t do anything here. 

Just click save changes here. Now go back to the backend. You’ll see a new .htaccess file created inside the public_html folder. 

Alternatively, you can download the default .htaccess file by searching on Google. Just upload this file using the upload button at the backend of your website.

Step 4 - Database error fix 1

If step 3 doesn’t work, step 4 is to go to file manager => public.html. 

Take a back-up of your wp-admin and wp-includes folders. 

Then delete these two folders. Now load the website on the browser. 

If server error doesn’t show up now, you’ll need to download a fresh copy of WordPress from wordpress.org, decompress the compressed folder, grab a copy of wp-admin and wp-includes folders and put them in the public_html folder. 

If deleting these two folders doesn’t solve the server error issue, there is no issue with these folders. So you can put them back from the back-up you created.

Step 5 - Database error fix 2

The final troubleshooting method may be tried only as a last resort. 

In this, you’ll upload a new WordPress software without affecting any of your existing content. 

If you have already downloaded the latest WordPress software, go to that decompressed folder of that software. 

Delete the files wp-config-sample.php and wp-content from that folder. Now compress the folder with all the remaining files. 

Go back to the file manager in your cPanel. Upload the zip file you just created using the upload option. 

Once uploading is completed, decompress the folder. This will overwrite all the files here except for the files wp-content and wp-config-sample.php. 

Now go to your browser and see if the site loads.

What next?

Kudos to you if you managed to fix your 500 server error!

In the process of this troubleshooting, if you have messed up your site at any point, you have a backup of the site. So nothing to worry.

In most cases, HTTP 500 error resolves itself. Even if it persists, you can follow the steps given above to troubleshoot the issue. 

If none of them work, you should take the help of your hosting provider. You may need an expert’s help to quickly solve the error.

What do you think of these troubleshooting methods? Have you encountered 500 errors lately? If yes, please share how you resolved them.

 

Leave a Comment