You can configure error viewing in two places in php.ini or directly in a file.
php.ini
Open the file and add or modify the line:
error_reporting = E_ALL | E_STRICT
This says to display all types of errors and warnings E_ALL
is enough however in php5.3 some warnings have been separated for E_STRICT
, so keeping the two is more compatibility issue and certainty that all types errors / warnings will be displayed.
Per file
You can view the errors / warnings of only one particular file using the error_reporting()
and ini_set()
functions.
The first function overrides the default value (that comes from php.ini) of the display_errors
directive to display the errors another passable value is -1
which has the same effect as true
. The second function sets the level of errors that will be displayed.
<?php
ini_set('display_errors', true);
error_reporting(E_ALL|E_STRICT);
$str = 'inválido'