ferror ??

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


  in the interests of performing robust error checking, i'm trying to write
file code along the following lines:

  $file = @fopen( ... );
  if ($file === NULL)
    // show error mesage here.

  Unfortunatley, PHP does not seem to have something like the ferror()
function to find out exactly why the file open failed.

  any other alternatives?  I don't want to print the ugly warnings on the
screen, as the end user doesn't really care why
/home/httpd/webapps/webapp1/logs/blahblah.log couldn't be accessed.

  any suggestions?  i suppose i could have PHP write errors to log files and
go snooping through those, but that's a bit unattractive.


I am not an ANGRY man.  Remove the rage from my email to reply.

Re: ferror ??

Mark wrote:
Quoted text here. Click to load it

instead of $file = @fopen( ... ); try something like this:

if($fh = @fopen($tmp, 'a')){
    @fputs($fh, $data);
    echo 'trouble in paradise';

Site Timeline