PHP error reporting: which to use E_ALL, E_ALL & ~E_NOTICE or ~E_ALL

Jun 25 • All • 908 Views • No Comments on PHP error reporting: which to use E_ALL, E_ALL & ~E_NOTICE or ~E_ALL

Speaking of error reporting in PHP we might all have seen the above values. So what do they mean? Which settings should I be using? What is the purpose and difference between these values? Let find that out!!

What the error_log will contain depends on the settings we use:

E_ALL : Everything


E_ALL & ~E_NOTICE : Report all errors except E_NOTICE


~E_ALL : Stop all

 

So, wait. Wont you be wondering ‘Isn’t it better to have all errors and notices to be logged as it creates more idea of the website and its issues.’

Well, there are instances when the disk space of accounts suddenly increase or hit its limits and with a little debugging you come to find that it is just the error_log file which gre exponentially to a large size. So, you might want to disable notices from being logged as they are not errors and just a deprecation warning or something you might be knowing.

E_NOTICE is helpful to analyse programming related errors.

Change PHP Error reporting settings in cPanel server (with PHP Selector)

  1. Login to cPanel (eg: http://example.com

  2.  Navigate to cPanel >> Software and Services >> Select PHP Version.

  3. Now select Switch To PHP Options

 

1

 

 

 

 

 

 

 

2

You can set/change error_reporting here

3

If the server does not come with CloudLinux and PHP Selector, then you will have to change the settings via php.ini or .htaccess

 

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

« »