Forum Moderators: coopster
The purpose of the program is to read some logfiles we import to our webserver and parse out some lines which are displayed on a website (near real time stats essentially)
All this works fine but one part of my output does not read as I would expect.
When my script reads each logfile it also picks up the date and time of the last modified time of the file. As these logs are replaced every 10 minutes its important I can see when the latest stats are essentially. I use the filemtime() function.
The basic funtionality seems to work but the time I get out is odd. I have broken my code down to a simple read the file time and print it on screen but this returns the same time.
If I telnet to the server and read the last modded time it says (at present 10:22) But my php script outputs 10:02. This seems to stay like this for an hour then outputs 11:02.
Its like it only sees hourly changes (always at 2 mins past the hour) I thought it might be some sort of cacheing so have called clearstatcache() in my script but this makes no difference. What time is this showing me here then if its not the true system file modification time? any ideas?
I have tried this out on my test server also with the same result- is it a php issue or a server issue? (Apache 2/php4.3.4/ Mandrake Linux 10
print "filemtime<br>";
$create = filemtime ($logtan);
$time = date("H:m d/m/y", $create);
print $time. "<br>";
$create = filemtime ($logbir);
$time = date("H:m d/m/y", $create);
print $time. "<br>";
$create = filemtime ($logbsw);
$time = date("H:m d/m/y", $create);
print $time. "<br>";
$create = filemtime ($logliv);
$time = date("H:m d/m/y", $create);
print $time. "<br>";
$create = filemtime ($logenf);
$time = date("H:m d/m/y", $create);
print $time. "<br>";
$create = filemtime ($logrdg);
$time = date("H:m d/m/y", $create);
print $time. "<br>";
$create = filemtime ($loggnw);
$time = date("H:m d/m/y", $create);
print $time. "<br>";
clearstatcache();
?>