Skip to the text

EASYTECH ARCHIVE · AMBER-TERM 1989

$ less ~/blog/error-reporting-in-php-scripts.txt

-rw-r--r-- cesar Dec 02 2010 error-reporting-in-php-scripts.txt

ARCHIVED · written in 2010. Kept as it was; some of it may be out of date.

Error reporting in PHP scripts

It often happens that you are trying to debug a PHP script running from command line or a part of your code and the script mysteriously dies. Depending on your server configuration (or command line) errors may be being silently being hidden. In those cases I recommend you add the following lines to your code to guarantee that all errors, notices, etc will be printed.

<?php

 // set error reporting para que reporte TODO
 error_reporting(E_ALL);
 ini_set('display_errors', 'On');

 // The rest of your code ...

This post is really for reference since most PHP developers already know this …