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 …