WordPress Error 500 Debugging Using the error_log File

WordPress is one of the most popular websites building applications. It is so versatile that is can help you create virtually any website you see on the Internet. It has the largest community and people from all over the world create new plugins, themes and help make WordPress even more secure. Making changes to its functions almost daily has both benefits and negative. In this article, we will focus on the WordPress Error 500 debugging and more specifically how to use the error_log file that is located in your WordPress files and how this log can make your life easier when finding critical errors in your website.

Debugging WordPress http Error 500 and Using the error_log File

There are many reasons why you can receive a 500 HTTP Error on your WordPress installation. We will try to explain how to debug your website by using the error_log file and listing the most common reasons for you to receive an Error 500. In most cases when you receive the following on your site looks this way. This might be very frustrating as for a beginner user, this error does not show anything. Your site is not working and you might panic.

A screenshot of Error 500 on Chrome

With WordPress applications, there are generally two reasons for this error to occur

  • a .htaccess file with faulty rules
  • incompatible plugins, mostly after a recent update
  • incompatible PHP version

It could also be due to an incompatible PHP version, for example, some of your Plugins or even your Theme could’ve been created to work with older PHP version (like 5.6), in this case, you can try changing the PHP version of your site. You can take a look at how you can change the PHP version for your account from our article here.

Debugging .htaccess rules

Some plugins use to write rules in your .htaccess file and in most cases, those are secured, however, in some plugins can cause this issue for you. To identify if the Error 500 is coming from your .htaccess you can disable it completely and access your site again. The easiest way to disable the .htaccess file is to rename it, add some text to its name, or add _OLD at the end of the file`s name. Alternatively, you can take a look at the cPanel’s tool called Errors

A screenshot of the cPanel Errors Tool

Debugging with the error_log file

The error_log file is standard for any PHP application including WordPress and it helps troubleshoot runtime errors by showing you exactly what happened wrong.

Let’s say that for example, we had a faulty PHP code in our index.php file

A screenshot of a faulty PHP code

The error_log file will display what went wrong so that we can troubleshoot it later

A screenshot of an error_log file displaying common errors

As WordPress is PHP based application the error_log file can greatly help us indicate why we’re receiving an Error 500.

What is the error_log file location?

The error_log file is usually present in the directory:

/home/$user/document_root/error_log

If the website is the primary for your cPanel account it is present at:

/home/$user/public_html/error_log

A screenshot of cPanel File Manager - WordPress error_log Location

Managed WordPress Hosting with Personal WP Assistant

Finding common issues with the error_log file

If a plugin is responsible for your site not showing up – your error_log file will show something like:

A screenshot of WordPress Plugin error_log indication

What you should do to troubleshoot the faulty plugin is to disable it through your File Manager, for this simply navigate to the plugin directory and rename the plugin folder

/wp-content/plugins

Rename the faulty /wp-content/plugins/plugin-name to /wp-content/plugins/plugin-name-disabled

A screenshot of WordPress Plugin Renaming in cPanel

Turning WordPress’ error displaying on

By default WordPress might not display errors or log them due to security reasons, for example, you wouldn’t want other people visiting your site to look at sensitive information like your Database Name, User and Password which can leak. You can turn WordPress’s error displaying by doing the following:

Navigate to:

cPanel -> Select PHP Version -> Choose your current used PHP Version -> Switch to PHP Options on the top right

Change error_reporting to E_ALL

A screenshot of how to change cPanel's PHP Error Display to E_ALL

You can also edit the wp-config.php file within your Document Root and change the following line:

define(‘WP_DEBUG’, false);

TO

define(‘WP_DEBUG’, true);

This will enable visual displaying of some errors on your WordPress site.

A screenshot of turning WordPress's Debug Mode on

If the issue persists you can always contact us for further assistance, our team is here for you! WebHostFace offers excellent WordPress web hosting packages at a very affordable price. Start your new project or transfer your existing websites to us – our hosting packages now come with 80% discount OFF the regular price!