Maintenance WP’s blog

How to fix a 500 error in WordPress?

22 Apr 2022 | WordPress Support

Capricious, she strikes at any time. A bit rude, it never asks permission before appearing on your screen.

Annoying, it poisons your daily life as a webmaster. And, to top it all off, it keeps the mystery alive: it’s impossible to know exactly what’s causing it.

It’s the 500 error on WordPress. An error you probably never want to see happen… but it doesn’t only happen to other people

Have you already experienced it? By the end of this article, you’ll be able to fix it with 9 concrete, practical and detailed solutions.

What is a 500 error?

A 500 error is an internal error of the server on which a website is hosted. The server encounters an unexpected problem and is unable to display the request sent by the web browser.
The latter then displays an error message on your screen. As a result, the page remains unavailable and does not load.

The Mozilla web browser documentation refers to this error as a “generic catch-all response” because the reason for it is unidentifiable.

More specifically, a 500 error is an HTTP error, which falls into the family of server errors. Among them, you may have also heard of :

  • 502 error(Bad Gateway or Proxy Error). According to Mozilla, this “indicates that the server, acting as a gateway or proxy, has received an invalid response from the upstream server”.
  • the 503 error (Service Unavailable, which refers to the state of a server temporarily unavailable or under maintenance

Besides this, you also find errors from the HTTP client (your web browser), like the famous 404 error (page unavailable).

Or redirection errors, such as the well-known 301 redirect, which means that a page has been permanently moved.

What forms can a temporary 500 error take?

The 500 error is a generic error: it can occur on WordPress, as on any other CMS(Content Management System).

The error message it displays on your screen can take different forms, with one constant: the presence of English terms, most of the time.

In particular, you may come across the following variants

  • 500 Internal server error;
  • Internal server error ;
  • Error 500 Internal server error ;
  • 500 Internal server error ;
  • This page isn’t working : HTTP error 500 ;
  • Temporary Error (500) ;
  • 500 Error ;
  • HTTP status 500: The server encountered an internal error () that prevented it from fulfilling the request.

To put a picture behind the words, here’s what it might look like when it decides to show up:

WordPress 500 error

What are the common causes of an HTTP 500 error?

This 500 error, on WordPress or elsewhere, never happens by chance. There are several reasons why it may suddenly appear on your screen. Here are the main ones:

  • an internal error in your .htaccess file. The latter is a configuration file for the Apache server, the one most used by web hosts. Sometimes it can be corrupted, for example after installing a new extension, or because of a syntax error in the code. In this case, a 500 error is displayed on your WordPress site;
  • an error in the permissions of your files. It is no longer possible to access and modify them, for example;
  • insufficient server memory. Each web host allocates a PHP memory to WordPress. If this is not enough, your web hosting server will not have enough resources to perform certain actions. As a result, a 500 error will be displayed on the domain name you want to view
  • incompatibility between plugins or themes after a recent installation or upgrade;
  • An incompatible or obsolete version of PHP. PHP is the server language under which WordPress runs. For your information, at the time of writing, WordPress was requiring your hosting server to use PHP version 7.4 or higher.
  • A recent update of the WordPress core that went wrong.
Une erreur 500 peut intervenir sur WordPress et d'autres CMS.

What are the consequences of a 500 error on WordPress?

No webmaster likes to be confronted with a 500 error on WordPress. Even more so when you consider the negative impact it can have on your business and your activity

The longer it takes to resolve a 500 error, the more you expose yourself to the following consequences :

  • a degradation of the user experience (UX). If your visitors can’t access your content, they won’t get a solution to the problem they are experiencing. Frustrated, they will surely go and look for what they did not find on your domain name pages on your competitors’ websites;
  • a decrease in traffic, with a potentially negative impact on your natural referencing (SEO). When Google’s robots are repeatedly confronted with 500 errors, they will tend to slow down the exploration of your pages(crawl).
    And if these 500 errors do not disappear, Google may remove the URLs (web addresses of your pages) concerned from its index.
    In this case, your pages will no longer be visible on the Google search results page (the SERP), until the error is resolved.
  • a drop in your conversion rate. If potential visitors can no longer access your pages, you will not be able to make them perform specific actions such as buying a product, filling out a contact form or subscribing to your newsletter.

In order to avoid these annoyances, see now how to get rid of a 500 error on WordPress thanks to practical and illustrated tutorials for different cases.

9 solutions to fix a 500 error on WordPress

About to try to fix a 500 error on WordPress? Get to the root of the problem by applying the solutions below in order, if possible.

The steps to take are simpler and less technical at first. They can sometimes be enough to solve an HTTP 500 error.

This can save you from having to handle sensitive and delicate files that did not need to be touched. And thus to carry out support on your WordPress site for nothing.

Reload the page

To get started, start with the most obvious solution: refresh your page. Sometimes a 500 error is fleeting and goes away on its own, with a snap of the fingers

To reload a page on your browser, you have two major solutions

  • press the F5 key on your keyboard, depending on the system used (Windows, MacOS, etc.)
  • click on the icon to refresh the current page.
Refresh page
The Google Chrome browser has an icon to refresh the page of the domain name you are viewing.

If this does not solve the problem, wait a few minutes and try again.
In parallel, check also the display of your page on different devices (computer, smartphone, tablet) and browsers (Chrome, Mozilla, Safari, Opera etc.).

You can also use this service to check whether the 500 HTTP error applies to everyone, or just to you.

The error persists? Empty your web browser’s cache.

Here’s how to do it on the Google Chrome browser (the system used Windows, MacOS etc. does not matter), the most used by Internet users in France

  1. Click on the 3 small dots at the top of the toolbar, on the right
  2. Choose More Tools > Clear Browsing Data.
  3. Check the box “Cached images and files” and click on “Clear data”.
Vider le cache de votre navigateur peut aider à réparer une erreur 500.

So what does this look like on your screen? If the 500 error remains fixed in front of your eyes, move on to the next solution.

Contact your web host

As you know, a 500 error is a server error. Therefore, your web host may have information about a possible problem with their services.

Contact him to try to sort out the real from the fake. And in the process, tell them about your problem. Even if the problem is not caused by their services, you might be able to get help, who knows.

In any case, if you are too often confronted with 500 errors, the quality of your host’s servers may be responsible

Then think about changing your offer, for example by switching to a dedicated server if you are on a shared server (you share the server resources with other sites). Or go to an efficient host like Kinsta

Your host couldn’t save the day? You’re going to have to deal with this 500 error on WordPress a lot more closely. However, don’t get ahead of yourself!

Before you make any technical changes, make sure you back up your site (files + database).

The easiest way to do this, for the unseasoned webmaster, is to use a backup plugin. You can use UpdraftPlus or BackWPup.

For your information, you can also back up WordPress manually by downloading the desired files from your FTP (File Transfer Protocol) client. This is software that connects to your hosting server so that you can manipulate the files and folders that make up your WordPress site.
Another option is to use the backup function offered on your cPanel interface, if your hosting company offers it.

Controlling plugins and the theme

Let’s get to the technical part. The first thing to do is to check your plugins and your theme.
These two can cause a 500 error on WordPress, especially after you have updated them.

To be sure, the first thing to do is to disable each extension one by one to find the possible culprit (via the Extensions > Installed Extensions menu).

Désactiver des plugins peut réparer une erreur 500.

Each time, reload your page on your browser to see if the error disappears. When you have unmasked the plugin that caused the error, delete it before installing it again, or replacing it with an alternative extension.

This first method has a limit: your WordPress administration interface (back office) will probably not be accessible. The connection will be impossible… so you won’t be able to do your manipulations in peace.

To deactivate your plugins, you will have two solutions

  1. Use an FTP client like Filezilla (free and open-source). This is the solution we will detail next;
  2. Go through the admin connection interface of your host.

So, using Filezilla, follow these steps after logging in:

  1. In theroot folder of your website, double-click on the “wp-content” folder, then rename the “plugins” folder inside, calling it “plugins-error” for example.
Le dossier sur un client FTP comme Filezilla.

2. Create a new folder called “plugins” (like the old one). Following this action, WordPress will automatically deactivate all your WordPress plugins.
3. Log into your WordPress dashboard, if you can, and then reactivate your extensions one by one, until you find the culprit.

The process is exactly the same for your theme. If your dashboard is accessible, activate another theme (e.g. a native theme starting with Twenty) to see if the error persists. If you can’t access your back office, download your active theme folder to your Filezilla interface, then delete it.
WordPress will automatically default to one of its native themes.
If the error hasn’t disappeared, tackle the .htaccess file.

Check the .htaccess file to fix the 500 error on WordPress

If your plugins and theme are not at fault, it is possible that your .htaccess file is corrupted. To be sure, recreate one.

First, you should know that this file is automatically regenerated when you update your permalinks (the addresses of your site’s pages). On the WordPress admin, this happens in Settings > Permalinks.

  1. On the root folder of your WordPress site (usually called public_html, htdocs or www depending on your host), change the name of your .htaccess file. For example, call it .htaccess_old.
Une erreur 500 peut se réparer via un fichier .htaccess.

2. If this operation allows you to access your WordPress admin, save your permalinks and you’re done. If not, go to the next step.

3. Create a new file called .htaccess on your FTP client. To do this, right click and select “Create a new file”.

4. Add its default code, which is provided in the WordPress documentation.

Un exemple de fichier .htaccess proposé par WordPress.

This new .htaccess file still doesn’t allow you to access the pages of your site? Go to the next solution.

Increase the amount of memory allocated to the server

A temporary 500 error code can also be caused by a limitation in the amount of PHP memory allocated by your hosting provider.
The lower the memory allocation, the harder it is for WordPress to load your site’s resources (images, plugin code etc.).

Fortunately, you can manually increase the PHP memory limit by adding this line of code to your “wp-config.php” file, located at the root of your site:

define('WP_MEMORY_LIMIT', '1024M');

Note that if your host imposes a memory limit equal to the one that WordPress proposes by default (64 MB), you will not be able to go beyond it, no matter what value you enter in the line of code above (128 MB, in this example).

Beyond the wp-config.php file, it is also possible to increase the PHP memory limit by adding a line of code in the .htaccess file or in the php.ini file, but the manipulation is a bit more technical and risky. The php.ini file is not always visible on your FTP client which makes the task less easy.

Modifying the PHP version

As you read earlier in this article, WordPress is written with the PHP scripting language, which allows it to function

PHP is a regularly updated language. For security and performance reasons, it is advisable to use one of the latest versions.

An outdated version of PHP can cause a 500 error on WordPress, because some scripts or plugins need a specific version of PHP to run correctly.

Changing your PHP version is very simple, and can be done through your hosting provider’s cPanel interface (again, if they offer this hosting interface).

To do this, click on “Select a PHP version” in the “Software” box.

Choose the PHP version you are interested in, and that’s it. As a reminder, WordPress recommends a PHP version at least equal to 7.4.

Vous pouvez modifier votre version de PHP sur cPanel pour essayer de réparer une erreur 500 sur WordPress.
This website needs a PHP update, for example.

Updating the PHP version on cPanel can make your site unavailable, especially because some plugins would not be compatible with it. This is not that common and can happen especially with the most recent versions of PHP.
To be on the safe side, use a test environment, for example using the
WP Staging.

Control access rights to files and directories

All your efforts have not been rewarded yet? It is possible that the access rights of the files and directories of your WordPress site(s) have caused a 500 error

This happens when the access rights are incorrect due to an error or malicious manipulation.

Regarding file and folder permissions, the WordPress documentation recommends the following

  • All directories must be on permission 755 or 750.
  • All files must be set to 644 or 640 permission. One exception: wp-config.php should be set to 440 or 400 to prevent other users on the server from reading it.
  • No 777 permission should ever be given to a directory.

To find out if your files and directories have the right permissions, check them by logging into your FTP client, then take a look at the “Access Rights” column.

If something is wrong, right-click on the file or directory in question, then change its permission by choosing “File Access Rights”:

Un exemple de droits d'accès aux fichiers.

Check your server logs to fix the HTTP 500 error

Checking the permissions of your files did not change anything? Then move on to an even more technical solution: checking your hosting server’s logs.

A log is a text file that shows the history of events on your server. So you can detect a trace of a 500 error on WordPress.

Some hosts offer a log file on their interface, which makes it easy. If yours doesn’t fit into this box, again, your FTP client can provide you with an answer.

If a log file is present, it will look like this: error.log.

Don’t see it? Use the debug mode of WordPress to display it, if possible on a test site (local or on a staging environment).

Use debug mode by enabling a PHP constant called WP_DEBUG. You will find it in the “wp-config.php” file, which is located at the root of the site (in the “public_html” folder for our example) on your FTP client.

In this file, manually replace the value “false” by “true ” on the line below:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Any errors related to PHP will appear in a log file named debug.log, accessible on your FTP via the following path: wp-content > debug.log.

If you want your errors to be displayed on screen, simply set the constant ‘ WP_DEBUG_DISPLAY' to true

And when you’re done debugging your site, remember to set the ‘ WP_DEBUG' constant to false (no need to delete the code snippets).

Reinstalling the WordPress Core

Last resort to get rid of persistent 500 error codes? Reinstalling the WordPress Core files, the original files that were present when you downloaded WordPress

To do this, follow the steps below

  1. Download the same version of WordPress that is currently running on your site. They are all available on this page. Unzip the archive.
  2. Upload the wp-admin and wp-includes directories to the root of your site, on your FTP client. These two directories will automatically overwrite the wp-admin and wp-includes folders already present.
Les répertoires wp-admin et wp-includes.

3. Refresh the page with the 500 error, which should have worked in principle

You will notice that the wp-content directory, which contains your theme and plugins, has not been touched.

This is normal: in principle, they are not involved. And this way, you don’t touch the features already installed on your site and its visual structure, controlled by your theme.

If you are in the habit of backing up your site frequently, you can also restore it using your latest backup. This is an effective stopgap measure, but be careful.

If your last backup was several days or even weeks ago, you will lose the benefit of all the additions you have made in the meantime, both in terms of content and design
.

What to do if a 500 error persists on WordPress?

Because it doesn’t warn or give any indication of the source of the problem, a 500 error on WordPress is often disconcerting for the webmaster.

Throughout these lines, you’ve discovered how to fix the 500 error using several solutions such as checking your plugins and your theme, or creating a new .htaccess file

One thing is for sure: you’d better fix this error quickly, or you’ll be penalizing your site’s user experience, your SEO and your conversions.

You want to be accompanied in the implementation of our various solutions to resolve a 500 error? Contact the WP Maintenance team, specialists in technical support on WordPress

Available 7 days a week, we will offer you a tailor-made solution that will meet your needs with speed, professionalism and efficiency.

Related posts:

How to choose a WordPress expert?

How to choose a WordPress expert?

To make your digital project a success, you will need one or more WordPress experts. But how do you recognize these rare gems?  What are the skills and qualities required to be defined as an "expert"? And most importantly, what kind of expert do you need for your...

Upgrade your WordPress site to HTTPS

Upgrade your WordPress site to HTTPS

Going HTTPS on a WordPress site is now more than necessary if you want to acquire new users and gain their trust by offering them a secure platform. But why is it necessary to migrate a WordPress site to HTTPS? What does it really mean? Maintenance WP gives you all...

Website: What’s the use of WordPress support?

Website: What’s the use of WordPress support?

In the course of managing a website, it is common to be at times unable to use certain features of the site, or to have difficulties in administering, updating or improving it - be it due to a bug or lack of skills. However, there is a solution that can help you...