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?