| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2003-10-27 17:32 UTC] iliaa@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 08:00:01 2025 UTC | 
Description: ------------ ok, i've written a "watcher-tool" for my /var/log/mail, which is a syslog-file (for pop-before-smtp with sendmail, but this doesn't matter). i have a never ending do-while with a sleep of 4 seconds, and i use filemtime to see if something changed in /var/log/mail. well, the problem was, the script never went through even if the file got changed (i've checked that with ls -l many times...). only if you get filemtime of another file between two filemtimes of /var/log/mail, php noticed that the file modification time changed. well, but if you edit the file by an editor, php does notice it. first i thought, its a matter of syslog-daemon, but since i tried to use filemtime on another file between two checks of /var/log/mail, im not sure anymore... Reproduce code: --------------- #!/usr/local/php/bin/php <?php $file = "/var/log/mail"; $filemtime = filemtime($file); do { sleep(3); echo "not out yet!"; } while (filemtime($file) == $filemtime); // you'll never get out, even if the log-file gets changed :) echo "im out (but this will never happen :p)"; ?> Expected result: ---------------- Get out of do ... while as soon as sendmail/postfix/qpopper/ipopd/whatever writes something to your /var/log/mail Actual result: -------------- you won't get out :p