"last modified" code not working on new server :-(

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: "last modified" code not working on new server :-(
Groups: php.general 
Request: Send a blank email to php-general+get-102653@lists.php.net to get a copy of this message
Summary: A working piece of PHP code is not working once moved to a new server. Details: 1) Old server running PHP/4.0.6 vs New server running PHP/4.1.2 (*) 2) Error message received is: Warning: stat failed for (errno=2 - No such file or directory) in /www/global/php/lastmodified.php on line 10 3) line 10 is: $newDate = filemtime($newFile); // get date from newFile 4) The whole code is below for review. The code in question is supposed to return the most-recently modified file in a directory (this was found at the PHP.net site) <?php // last update $newFile=""; // init newFile $handle=opendir('.'); // open dir while (false!==($file = readdir($handle))) { // read all files in dir if ($file != "." && $file != "..") { //only if file is not . or .. $fileDate = filemtime($file); // get date from file $newDate = filemtime($newFile); // get date from newFile if ($newDate < $fileDate) { // if file is newer $newFile = $file; // replace newFile with newer file } } } closedir($handle); // close file $newDate = filemtime($newFile); // get date from newFile $fileModDate = date("d/m/Y",$newDate); // convert date Print("updated: $fileModDate"); // print date ?> (Is PHP/4.1.2 secure? I know it's not the newest) Any clues why this isn't working? Thanks TjL, PHP neophyte

« previous php.general (#102653) next »