WP Latest

How to Fix a 500 Error on Your WordPress Site


How to Fix a 500 Error on Your WordPress Site

A website can suddenly stop working for a variety of reasons. Successful requests for a website usually give a status code of 200. One of the first things that we can do when a website isn’t working is to find out the status code returned by the server. This might not always lead you directly to the root cause of the problem, but it can sometimes help in determining the next series of steps that you can take to get the website up and running again quickly.

In this post, you will learn how to fix a 500 error on your WordPress website.

What Is a 500 Error and What Causes It?

A 500 error basically means that the server has come across an unexpected situation that it didn’t know how to handle. As a result, it serves users with either a 500 error page or a completely white screen.

The explanation doesn’t help us much, but there are some common things that can cause this error. Here are some examples:

  1. a corrupt .htaccess file
  2. faulty or incompatible plugins
  3. limited PHP memory
  4. corrupted WordPress core files

Fixing a 500 Error on a WordPress Website

Now, we will briefly go over the steps that you can take to resolve any errors caused by the issues mentioned above. Let’s get started.

A Corrupt .htaccess File

Any misconfiguration of the .htaccess file can potentially cause a 500 error. You should consider reading this getting started guide on .htaccess to learn more about this file if you aren’t already familiar with it.

The easiest way to fix it is to take a backup of the current .htaccess file and then delete it from your server. You can usually find it in the root directory of your WordPress hosting account.

Download and Delete .htaccess FileDownload and Delete .htaccess FileDownload and Delete .htaccess File

Make sure you download the file first before deleting it. This will allow you to upload it again if you find that the .htaccess file wasn’t causing the error.

Try visiting your website after deleting the .htaccess file. If deleting the file resolves your 500 error, you can generate a fresh .htaccess file by visiting Settings > Permalinks and then clicking on Save Changes. Otherwise, simply upload the old .htaccess file back to your server.

Generating an .htaccess FileGenerating an .htaccess FileGenerating an .htaccess File

Faulty or Incompatible Plugins

Sometimes the plugins or themes that you have installed can result in a 500 error due to some incompatibility or other faulty code. The best way to resolve any errors caused due to this incompatibility is to simply deactivate all the plugins and then see if you are still getting the 500 error.

If deactivating all the plugins solved the problem for you, then this means that one of the plugins is causing the 500 error. Now, you can start activating each of them one by one to see which of them is at fault. Keep checking the website for a 500 error after activating each plugin.

Deactivated WordPress PluginsDeactivated WordPress PluginsDeactivated WordPress Plugins

If activating a plugin shows you a 500 error, you can contact the plugin developers to let them know about this issue so that they can fix it in the next update or suggest a quick fix.

Limited PHP Memory

Although rare, it is possible that you are getting a 500 error because something inside a theme or plugin is exhausting all your allocated memory. One quick fix for this is to simply increase the memory limit.

Open the .htaccess file that you learned about in the first section and place the following lines inside it.

php_value memory_limit 512M
php_value upload_max_filesize 64M
php_value post_max_size 64M

It would be better to place them just before # END WordPress in order to avoid any unexpected surprises. This should increase the allocated memory. You can check the new values by going to Tools > Site Health > Info > Server inside the WordPress admin dashboard.

WordPress Site Health InformationWordPress Site Health InformationWordPress Site Health Information

Remember that this is just a temporary quick fix. The ideal solution would be to find out what exactly is causing this spike in memory use and then fix that function inside the plugin or theme. Otherwise, you will run out of memory again sooner or later.

Corrupted WordPress Core Files

It is highly unlikely that corrupted WordPress core files could be causing a 500 error on your website. However, this fix is worth a try if none of the above resolved the error for you.

What we are trying to do here is replace the core WordPress files for two directories called wp-admin and wp-includes. You shouldn’t be making any changes to the contents of files located inside these directories as they are used to keep WordPress functional. Changing anything there either intentionally or unintentionally can result in a 500 error.

The first step is to visit the WordPress download page and get the latest version. After that, you can extract the contents of the downloaded file and replace the files inside the wp-admin and wp-includes directories in your WordPress installation with these fresh, unaltered copies using your FTP client.

Final Thoughts

In this post, I mentioned four different reasons that might cause a 500 error on your WordPress website and briefly explained how you can fix each of them. Hopefully, one of these will resolve the 500 error. Consider contacting your web host to get some additional help if none of the steps mentioned here worked for you.

Leave your thought here

Your email address will not be published. Required fields are marked *

Enable Notifications OK No thanks