How to enable or disable PHP error logging in cPanel? Print

  • 0

If your website uses PHP scripts, you may need to fix the problem. By default, PHP error viewing is disabled on your server for security reasons, but you can temporarily enable error viewing if necessary. Below are the steps to enable or disable the error log from the cPanel account.

Enable or disable PHP Error from Select PHP Version

Step 1: Log into your cPanel account.

Step 2: Go to the Software section and click on the Select PHP version.

PHP selector is not included in cPanel by default, so if you're hosting with another web host, you may not have them in your account. However, all Accuwebhosting customers will see a PHP version selection section in the cPanel of their hosting account.

Step 3: In the PHP Selector window, click on Options.

 

Step 4: Search the error_reporting option and click on the drop-down option next to it to choose the option you want.

E_ALL : Everything
E_ALL & ~E_NOTICE : Report all errors except E_NOTICE
~E_ALL : Disable all
E_ALL & ~E_DEPRECATED & ~E_STRICT

Step 5: If the changes were successful, you would see a message in a green box confirming that the changes have been applied.

Enable or disable PHP Error from MultiPHP INI Editor

Step 1: Log into your cPanel account.

Step 2: Search the MultiPHP INI Editor option in the Software section.

 

Step 3: In the MultiPHP INI Editor window, click on the Editor Mode tab at the top of the screen.

Step 4: Select the domain or subdomain from the Select a location field and click on it.

Step 5:The editor window may contain the listed items or be empty. Find and edit the following line (add it if it's not there):

display_errors = On
error_reporting = E_ALL

Note: The error_reporting line above shows all errors, notices, and warnings for PHP scripts within this domain or subdomains. You can use one or more of the constants listed here, separated by ampersands (&), to tune the types of errors reported.

Step 6: Click Save to apply the changes you made.

Now you can access and debug your PHP scripts. Errors found are displayed to the screen, written to the error_log file in the script's root directory, or wherever the script writes such errors.

Important Note: After fixing the issues reported by the PHP script, turn off error reporting by going to your cPanel editor and setting display_errors = Off.

That's all.

 


Was this answer helpful?

« Back

chat