Note that if error_log is empty, errors/warnings/notices will be written to stderr (standard error stream), and this may be a problem if you is PHP in CLI.
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
ini_set('error_log','my_file.log');
foreach(1 as $i);
ini_set('error_log','');
foreach(1 as $i);
ini_set('error_log','/dev/null'); foreach(1 as $i);
?>
php -f test.php
will output :
<?
Warning: Invalid argument supplied for foreach() in /test.php on line 7 # stdout
PHP Warning: Invalid argument supplied for foreach() in /test.php on line 10 # stderr
Warning: Invalid argument supplied for foreach() in /test.php on line 10 # stdout
Warning: Invalid argument supplied for foreach() in /test.php on line 13 # stdout
?>
Errors displayed in the stdout (standard output stream) car be catched with the output buffering functions (ob_start/ob_get_clean) while strerr cannot.