Establece el nivel de notificación de errores. El parámetro es un valor de tipo integer que representa un campo de bits, o constantes nominadas. Los niveles de error_reporting y constantes están descritos en Constantes Predefinidas, y en php.ini. Para establecerlo en tiempo de ejecución, use la función error_reporting(). Vea también la directiva display_errors.
En PHP 4 y PHP 5 el valor predeterminado es E_ALL & ~E_NOTICE. Esta configuración no muestra los errores de nivel E_NOTICE. Puede querer mostrarlos durante el desarrollo.
Configuración en tiempo de ejecución
Código que hay que integrar en el php para poder mostrar los errores.
[code]
error_reporting(E_ALL);
ini_set("display_errors", 1);
[/code]
Diferentes opciones que se le pueden pasar al error_reporting
[code lang=»PHP»]
<?php
// Desactivar toda notificación de errores
error_reporting(0);
// Notificar solamente errores de ejecución
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Notificar E_NOTICE también puede ser bueno (para informar de variables
// no inicializadas o capturar nombres de variables con errores ortográficos …)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Notificar todos los errores excepto E_NOTICE
// Este es el valor predeterminado establecido en php.ini
error_reporting(E_ALL ^ E_NOTICE);
// Notificar todos los errores de PHP (véase el registro de cambios)
error_reporting(E_ALL);
// Notificar todos los errores de PHP
error_reporting(-1);
// Lo mismo que error_reporting(E_ALL);
ini_set(‘error_reporting’, E_ALL);
?>
[/code]
Opciones de Configuración de Errores y Registro en el php.ini
Name | Default | Changeable | Changelog |
---|---|---|---|
error_reporting | NULL | PHP_INI_ALL | |
display_errors | «1» | PHP_INI_ALL | |
display_startup_errors | «0» | PHP_INI_ALL | |
log_errors | «0» | PHP_INI_ALL | |
log_errors_max_len | «1024» | PHP_INI_ALL | Available since PHP 4.3.0. |
ignore_repeated_errors | «0» | PHP_INI_ALL | Available since PHP 4.3.0. |
ignore_repeated_source | «0» | PHP_INI_ALL | Available since PHP 4.3.0. |
report_memleaks | «1» | PHP_INI_ALL | Available since PHP 4.3.0. |
track_errors | «0» | PHP_INI_ALL | |
html_errors | «1» | PHP_INI_ALL | PHP_INI_SYSTEM in PHP <= 4.2.3. |
xmlrpc_errors | «0» | PHP_INI_SYSTEM | Available since PHP 4.1.0. |
xmlrpc_error_number | «0» | PHP_INI_ALL | Available since PHP 4.1.0. |
docref_root | «» | PHP_INI_ALL | Available since PHP 4.3.0. |
docref_ext | «» | PHP_INI_ALL | Available since PHP 4.3.2. |
error_prepend_string | NULL | PHP_INI_ALL | |
error_append_string | NULL | PHP_INI_ALL | |
error_log | NULL | PHP_INI_ALL |
Para mas detalles y configuración del resto de directivas del php.ini mirar la url fuente
Fuente: http://php.net/manual/en/errorfunc.configuration.php
Es justo lo que precisaba, más de 4 años después de publicado. Cosas que nunca pierden vigencia. Gracias genio!