error or warning message in $php_errormsg

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
demi
Forum Newbie
Posts: 4
Joined: Fri Mar 21, 2008 6:28 am

error or warning message in $php_errormsg

Post 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?
Post Reply