How to enable PHP error logging and review the errors
Is your website not working? Are you getting an ‘Error 500’, but you don’t know why? In this tutorial, we are going to show you how to enable PHP error logging as well as how to review any errors that you might encounter on your shared hosting account.
How to enable PHP error logging
First, you will need to log into your cPanel account. Next, click on the ‘Select PHP Version’ button and once there, select the ‘Switch to PHP Options’ button as illustrated below:
From here, you want to check the ‘error_reporting’ line. In order to enable PHP error logging, you need to change the value to ‘E_ALL’ like this:
All changes that you make are automatically saved, meaning that you don’t need to click anything else. Once you have enabled the error logging, all of your errors will be written and stored into the ‘error_log’ file, which is located in your project’s home directory, which is in most cases the ‘public_html’ folder.
IMPORTANT: Some PHP applications can override the value of the error logging variable. Because of this, make sure to check it from time to time when installing new plugins or making changes to your cPanel account!
How to review the collected PHP errors
As mentioned previously, all errors will be stored in the ‘error_log’ file. We don’t recommend opening this file in your browser if you notice that it is too large. Instead, we suggest you download it onto your machine and then open it with an editor that can manage large log files in order to avoid crashes and in order to have a better visual presentation as well, which can help you spot given errors faster.