Your code is simply broken. You have to make sure $fd is a
    proper file handle before you try to use it:

    if ($fd = @fopen($filename, 'r')) {
      while(!feof($fd)) {
        ...
      }
      fclose($fd);
    }

    Btw, next time please ask on php-general@

    - Markus

On Fri, Mar 29, 2002 at 08:47:27AM +0100, Jan Pavlík wrote : 
> Hi,
> I have problems with logging events in PHP. When some user write example
> script from PHP.NET:
> 
> $fd = fopen ("/tmp/nonexists.txt", "r");
> while (!feof ($fd)) {
>     $buffer = fgets($fd, 4096);
>     echo $buffer;
> }
> fclose ($fd);
> 
> And when the file not exists, it run 30 seconds and the ended, but my
> errorlog is full with one errormesage about nonexistent handler $fd.... Can
> PHP log only first error and the next (the same, copy of the first) throw
> out?
> 
> P.S. Sorry for my English :)
> --
> Jan PAVLIK
> [EMAIL PROTECTED]
> ICQ 6611951
> ROOTSHELL.CZ - Make it easy and better!
> 
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc

"Mind if I MFH ?" "What QA did you do on it?" "the usual?" "ah... none :)"

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to