How to Fix the 500 Internal Server Error on Your WordPress Website

Updated on Oct 21, 2019

Perhaps the Internal Server Error is the most annoying error WordPress users can stumble upon. The reason for that is because 500 Internal Server Error could mean anything. However, there are ways to fix the error, which we will address in this post.

We will cover:

What is a 500 Internal Server Error?

When we visit a website, our browser would send out a request to the site’s server. The server would then process the sent request and provide back all resources which should result in displaying the page with its HTTP header, which also entails an HTTP status code. The code is to inform our browser about the status of the request. So, in case we get a status code 500, then something along the way went wrong, and the main problem is that the server cannot automatically determine what the issue is.

In short, the 500 error means the server has encountered a condition that was not expected and prevented it from fulfilling the request.

500 Internal Server Error Variations

There are several different variations of the error 500 message. It all depends on the web server or the browser we are using. Sometimes the website we are visiting could have its custom page for such errors.

Here are some variations of what we could see:

  • Error 500;
  • HTTP Error 500;
  • Internal Server Error;
  • Temporary Error (500);
  • 500 Internal server error;
  • 500 Internal Server Error;
  • HTTP Error 500 – Internal Server Error.

It does not matter which variation we see, the meaning stays the same—something went wrong, and neither we nor the server knows what it is (yet). The problem here is that even if we ask someone for help, we cannot get a straight answer. Nobody knows the conditions, not before we did some troubleshooting.

Possible Causes of the 500 Error in WordPress

Luckily, there are some common causes for the 500 Error:

  • Corrupted .htaccess file;
  • Plugin issues;
  • Theme-related problems;
  • PHP memory limits.

Creating a Backup is Essential

The fixes we will go through involve making some changes to our website’s root directory. We must not forget to create a full backup. And not just in that case, we have to always keep in mind that customizing the file structure of a WordPress site could break it quickly. A backup ensures that we can restore our WordPress site to its working state in case something goes wrong. We can do a backup just for our files, but it’s best to do a complete backup that would help you restore anything. We have a tutorial on How to Backup Your WordPress Website.

Solutions for Error 500 in WordPress

Keep note that there are no straightforward, 5-minute fixes for the 500 error. Solving it would require troubleshooting, time, and patience. Usually, fixing the error would help us determine what the actual cause is.

As mentioned above, the 500 error is an indicator of something going wrong, without giving us specifics. Essentially, when resolving the error, we have to work backward. First, we find the actual fix, and then we know what the reason was, which is beneficial for future mishaps of the same nature. In general, most of the 500 errors we witness are because of a server issue, but they could also happen due to a client-side problem. We will work through different solutions that involve both types of issues.

Check the .htaccess File

When the web host is running on Apache (as with FastComet), we could get a corrupted .htaccess file - something usually happening after we have installed a plugin or have made changes to our site. The fix here is relatively easy. All that we have to do is replace the corrupted .htaccess file with a brand new one.

Usually, what we have to do to create a new .htaccess file would be to go to our WordPress Dashboard and simply save the permalinks settings. But in case our site is down, it’s likely we can’t log in to our WordPress Dashboard, which rules out the permalinks option.

In that case, we will have to use cPanel File Manager or an FTP client such as FileZilla to access our website’s files and locate our .htaccess file. Before we go on and replace the old .htaccess file with a new one, we need to create a backup. We do that by simply changing the name of the original file to something similar to .htaccess-old. After we do that, WordPress will discontinue recognizing the file.

After we do the .htaccess action, we go ahead and refresh (CTRL+F5) the site. In case it loads the way it should, we can be sure that the .htaccess file was the reason for our 500 error. Now, we revert the .htaccess-old file to its original name. The issue will be back, but we are going to fix it:

  • We begin with the creation of a new .htaccess file;
  • We open it and write the following lines of code inside:
  #BEGIN WordPress
  <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  WerwriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  </IfModule>
  # End WordPress
  That’s the solution for the .htaccess case.
	

Increase Our Site’s PHP Memory limit

Our error 500 reason could be because of exceeding PHP memory limit. Usually, that happens because of poorly-coded plugins, lots of plugins, or whenever the site uses resource-intensive-plugins.

What we have to do is increase our site’s PHP memory limit. There are a couple of different methods for that. 

The methods involve updating the .htaccess file, php.ini file, or the wp-config.php file. For every one of the three memory fixes listed below, we have to remember to refresh our site, so we know it’s working. This way we will be sure what’s going on and why we get the 500 internal server error.

1. Increase the PHP Memory Limit in .htaccess File

Via File Manager, we find our .htaccess file website’s root and add the following code:

php_value memory_limit 256M

Doing this will increase memory limit to 256 MB.

Note: If we are not able to find your .htaccess file, we have to make sure that we can view hidden files: 

Show Hidden Files in File Manager

Also, if there is no .htaccess file, we need to create a new one, and paste the line above inside it.

Create a New htaccess File

2. Increase PHP Memory Limit via php.ini File

  • Find the php.ini file in the wp-admin folder in the site’s root directory;
  • Open the file and look for a line that starts with memory_limit;
  • If the line has included 64 MB or lower, we have to replace it with the following:
memory_limit = 256M
  • If we aren’t able to find our php.ini file (again, ensure that you have “show hidden files” enabled), then we have to create a new file. In this new file, we have to paste the above line, name the file php.ini, and then save it to our wp-admin folder.

3. Increase PHP Memory Limit via wp-config.php File

If updating both the .htaccess and the php.ini files did not work, we need to try increasing the memory limit in the wp-config.php file. We do that by:

  • Adding the following line to the wp-config.php file just before the happy blogging line:
define('WP_MEMORY_LIMIT', '256M')
  • Saving the file and refreshing our WordPress site;
  • If the method does not work and we suspect our plugins could be pushing the PHP memory limits, we need to get in touch with the web host by opening a support ticket. We ask for increasing the memory limit on the server-side.

Audit All Plugins

Plugins are occasional reasons for many types of errors in WordPress. They can also cause 500 errors, including outdated plugins that cause compatibility issues and even brand new, but poorly coded plugins. Sometimes we might even get the 500 error instantly after adding a plugin.

To find out which one of our plugins is the cause for the error, we have to bulk deactivate all plugins.

Bulk Deactivate WordPress Plugins

If the problem gets fixed, we start reactivating the plugins one at a time to see which of them is the source of our internal server error.

If we cannot access the WordPress dashboard, we use File Manager or FileZilla to get into our server and open the wp-content folder. We locate our plugins folder and rename it to plugins-test, which will effectively deactivate all plugins.

Then what we do is simply refresh our site. If it begins working, the cause of our 500 error is one of the plugins.

Our next step is to identify which plugin is the faulty one. To do this, we have to rename our plugins-test folder back to its original “plugins” and go into the folder to rename each individual plugin folder one by one, refreshing our site after each rename of a folder. After we have found the buggy plugin, we leave its folder renamed, and we contact the plugin’s developer with a proper bug report.

Check File Permissions

If none of the above has worked, we probably have an issue with the file permissions. Files in our WordPress directory should be set by default to 755 or 644 and if they are set to anything else it could set off a 500 error. Luckily, in this case, there is a quick fix for the permissions of all files and folders via the cPanel’s Terminal. 

What we have to do is: 

  • Go into the cPanel and open the Terminal (my.fastcomet.comcPanelTerminal);

    Find the Terminal in cPanel

    When we open the terminal, to go into the wp-content folder, we input the following line:
/home/$USER/public_html/wp-content
  • Next, we execute the command:
find . -type d -print0 | xargs -0 chmod 0755 && find . -type f -print0 | xargs -0 chmod 0644

That’s what will set all file and folder permissions to the proper ones (644 for files and 755 for folders). If that does remove the 500 error, we continue with the next option.

Reinstall The WordPress Core Files

It’s not unusual for core WordPress files to get corrupted, especially when we talk about older sites that were customized and updated multiple times.

To fix these issues, we would have to replace our core WordPress files with brand new ones. There is no actual need to re-install WordPress—we only have to download the WordPress version and then unzip the file. We use File Manager or FTP again to go into our site’s root directory and to upload the wp-admin and wp-includes folders from our zip file we just downloaded. Doing this will overwrite the older versions:

Select Files to Upload

Using this way to do it, we will not overwrite our plugins and themes. Next, we refresh the website. If the 500 error is gone, we have been successful and have pinpointed the cause for the Internal Server Error - corrupted WordPress core files.

Contact the Web Host

In case you are getting the 500 error even after working through all of the fixes above, you should seek help from your web host. At FastComet, we have a team of technical support experts that works 24/7 and is always ready to assist you. All you have to do is open a support ticket and make sure to explain everything you have already tried. This way, our technical support representatives would resolve your case as quickly as possible.

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

WordPress Hosting

  • Free WordPress Installation
  • 24/7 WordPress Support
  • Free Domain Transfer
  • Hack-free Protection
  • Fast SSD Storage
  • Free WordPress Transfer
  • Free CloudFlare CDN
  • Immediate Activation
View More