Page 1 of 1

error or warning message in $php_errormsg

Posted: Fri Mar 21, 2008 11:24 am
by demi
Here is the little program:

Code: Select all

<?php
    @fopen('/nonexistentfile.txt', 'rw+');
    echo $php_errormsg;
?>
 
I try to open nonexistent file. The warning which should return function fopen was suppressed by @. If property (of php.ini) track_errors equals On the next line return warning which caused by fopen. I see to the my local (ubuntu) php.ini and to the hoster php.ini, but there are track_errors equals Off. I guess, developers set this value as default. But why? I think this property is useful. Or not? How I can handle such errors and preserve page from unneeded message and prepare this message, for e.g., to write to log?