How to correct a 500 error on your Wordpress hosting

Procédure

Preamble

The 500 error is one of the most common errors encountered when creating a website, particularly on WordPress.

It's a common error, but it's vague as to why it occurs and can quickly become a real headache. In this article, we'll look at different solutions to this error to help you resolve it, whatever the reason.

Definition

First of all, let's quickly define what a 500 error is. In simple terms, a 500 error indicates that the request sent by the browser, the request to access the page, etc., could not be processed correctly by the site you are trying to access. The reasons for such an error may be diverse and the browser or the site cannot identify it.

Generally, a 500 error is caused by a problem on the server on which the site is hosted, so it is not the fault of the site visitor in the majority of cases.

Determining the cause of a 500 error

As mentioned above, errors can occur for a variety of reasons. In order to reduce the number of searches and correct the error as quickly as possible, try to remember the last actions carried out on your site before the 500 error occurred.

Did you add or modify a file? Or did you delete one? Perhaps your site was updated, either manually or automatically? Or perhaps you've added a plugin or theme to your site?

One of these actions may be the reason for your 500 error, and we're going to suggest a number of methods for checking this, but it's also possible - although rarer - that the error came from you.

First of all, check that you are connected to the Internet on your device and try to connect to another site. If this works, the error is not coming from here. Still talking about the network, check that the problem is not coming from your VPN, if you have one, by disconnecting it.

If nothing works, the problem may be with your browser; try using a different one if you have more than one, use another network or ask someone you know to connect to their device. Finally, try clearing your browser's cache.

If the problem is now solved or your friends and family are able to connect, then the error is probably yours and not the site's.

If the error is still present, then there is a good chance that it comes from the site, and more specifically from the server on which it is hosted. If you own the site, you can try the solutions below to try and fix the problem. Otherwise, contact the site owner or wait until services are restored.

Errors in the htaccess file

The most common reason for a 500 error is due to a corrupt or syntactically incorrect htaccess file, the server configuration file. The easiest way to check this is to recreate it from scratch. To do this, go to your server's File Manager, from your LWS Panel or your cPanel if you are an LWS customer, or using software such as FileZilla, and go to the root of your WordPress site.

How to correct a 500 error on your Wordpress hosting

In the root, find the ".htaccess" file and rename it as you wish:

How to correct a 500 error on your Wordpress hosting

Return to your site and refresh the page by pressing CTRL, SHIFT and R simultaneously to refresh the page without the cache. You can also delete your browser's cache again. If this corrects the problem, then you've found the culprit.

Delete the corrupted htaccess file and create a new one. Open it and add these lines inside:

# Start WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # End WordPress

This is the default content of the ".htaccess" file for WordPress. This should correct your error.

If the problem is not corrected, this means that the error did not come from the htaccess file.

Deactivate WordPress plugins

If the error does not come from the htaccess file, then the problem may be due to corrupt, obsolete or incorrectly installed plugins.

If you still have access to the site administration page, go to the Extensions tab and deactivate the plugins one by one, testing whether or not the error disappears:

How to correct a 500 error on your Wordpress hosting

If you don't have access to this page and you have LWS hosting, you can use the WordPress Manager:

How to correct a 500 error on your Wordpress hosting

On the page, click on "Scan" if no installation is detected and then on "Manage plugins" in the block for the site in question. In the popup that opens, deactivate the plugins one by one and test whether or not the error still appears.

How to correct a 500 error on your Wordpress hosting

How to correct a 500 error on your Wordpress hosting

If you are unable to use the previous methods, there is one last method. Go back to your File Manager, at the root of WordPress. Here, go to the "wp-content" folder and then "plugins". Here, rename the folder of the plugin you want to deactivate:

How to correct a 500 error on your Wordpress hosting

This will deactivate the corresponding plugin and allow you to test each plugin.

If a plugin was the source of the 500 error, try reinstalling it, and if the problem persists, look for an alternative to this plugin.

Changing the WordPress theme

As with plugins, error 500 can be caused by a corrupted WordPress theme.

Similarly, if you still have access to the administration page, go to the "Appearance" tab and then "Themes" and change it to another theme. If you don't have another, click on the "Add" button and install one from the WordPress shop.

How to correct a 500 error on your Wordpress hosting

As with the plugins, clear your browser's cache and refresh the page to see whether or not the 500 error is still present.

If you don't have access to the admin page and are an LWS customer, go back to the WordPress Manager and click on "Manage themes" for the site in question. Here, change the active theme and check that the error has disappeared.

The final method is to go to the database, using PhpMyAdmin. Connect to your database and look for the "wp_options" table.

In this table, look for the rows "template" and "stylesheet" and replace their values with the name of the theme you want to activate.

How to correct a 500 error on your Wordpress hosting

To find this name, in your File Manager, go to "wp-content" then "themes" and copy the folder name of the theme to be activated and paste it into the database rows.

How to correct a 500 error on your Wordpress hosting

If this has corrected your problem, uninstall the offending theme and find an alternative, or try reinstalling it to see if the problem has been fixed.

Modify PHP settings

Another solution we can suggest is to modify certain PHP parameters, mainly related to the memory allocated to it, in order to try and resolve the problem. The browser, plugins and theme consume a lot of memory to process all the requests, display content, etc... And the current values may be insufficient to handle all these requests.

On your LWS Panel, search for "PHP Configuration". On cPanel, search for "Select a PHP version" then go to the "Options" tab.

Here you can change the 'Memory Limit', 'max_execution_time', 'max_upload_size' and 'post_max_size' parameters, which respectively increase the available PHP memory, the execution time of a PHP script before the request is aborted, the maximum size of the files you upload and the maximum size of the forms used to send data.

How to correct a 500 error on your Wordpress hosting

The important parameter here is "Memory Limit", which you can increase to a maximum value defined by your formula.

If you can no longer increase it, or if the increase is not sufficient for your needs, you will need to change your formula.

Here you can also change your PHP version, if ever a specific version of PHP is needed for your site.

Fixing bugs manually

The last solution we can suggest is to activate the WordPress DEBUG mode in order to correct the 500 error yourself.

You can activate this from the WPManager or Softaculous (for cPanel):

How to correct a 500 error on your Wordpress hosting

How to correct a 500 error on your Wordpress hosting

You can also add or modify the following lines in the WordPress wp-config.php file:

// Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable debugging logging in /wp-content/debug.log.
define( 'WP_DEBUG_LOG', true ); // Disable the display of errors and warnings define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); // Use the development versions of the basic JS and CSS files (only necessary if you modify these basic files). define( 'SCRIPT_DEBUG', true );

These lines activate DEBUG mode and enable all site errors to be logged in the debug.log file.

Thanks to this log, you can find out the location and nature of the error and correct it. Don't forget to deactivate it once the problem has been resolved. To do this, uncheck the boxes in Managers or delete the lines added.

If even after all this the problem persists, the last solution is to restore a backup of your site to an earlier time, when it was still working, using the LWS backup manager. It may be necessary to restore both the website and the database in some cases.

Conclusion

That's it, you're now able to deal with all the 500 errors you'll encounter in the future. If there's one thing to remember, it's that a 500 error can appear for a variety of reasons and that knowing how to reduce the number of leads and choose the right solution to resolve the problem is key to managing 500 errors. If, even after trying all the solutions presented in this article, your error is still present, contact LWS technical support so that our agents can resolve the problem for you.

Related videos

This article is written in parallel with the video"Correcting a 500 Interval Server Error on WordPress". If you prefer to follow this tutorial on video, we invite you to watch this video.

Rate this article :

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problème technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

1mn reading

How does Yoast SEO work?

4mn reading

How can you optimise your Wordpress site?

1mn reading

How do I use Gutenberg on Wordpress?

2mn reading

How do I disable the Gutenberg editor on Wordpress?


Ask the LWS team and its community a question