Using phpinfo() to find out error reporting settings

When things go wrong, every programmer needs to know for development purposes where to look to debug the problem. The PHP function phpinfo() is the first place to look to find out how PHP is reporting errors. The following will print out all of PHP settings, directives and their values.

 echo phpinfo();

 

The "error_log" directive will let you know where errors are being written to. You can set the local value at run time inside your script or by editing your PHP configuration file "php.ini". For example, to set the local value via your PHP script:

 ini_set('error_log','error.log');

Two other directives are also important. The "log_errors" should be set to On and "error_reporting" to  E_ALL

Make sure for production (site going live) you turn off "display_errors" and "display_startup_errors" or they will show on your live site.

Comments

Popular posts from this blog

Build 6 is here

An example of chaining jQuery Ajax request callbacks

Creating hashtag hyperlinks on the fly for your website