Getting the actual error code for file operations

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
costas
Forum Newbie
Posts: 4
Joined: Tue Dec 09, 2003 10:15 pm

Getting the actual error code for file operations

Post by costas »

Assume the example:

$myFile = fopen("foo.txt","r");

If this returns false, how can I check what the reason for the error is? Is there an error type object or method like in VB?

I am actually programming in Linux RH9 and version 4.?? of PHP.

Thanks
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

may be this will be of help:
PHP manual wrote: The previous error message: $php_errormsg
$php_errormsg is a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the track_errors configuration option is turned on (it defaults to off).
Post Reply