From: robert at rw-it dot net Operating system: Linux PHP version: Irrelevant PHP Bug Type: Apache related Bug description: getlastmod() returns access time - solution
Description: ------------ With some combinations of mod_php and Apache, getlastmod() returns the access time instead of the modification time. All bug reports that deal with this seem to have been closed with "Works in CVS" or "Apache problem", both of which are not true. The Problem occurs if Apache was built with large file size (64-bit) support and mod_php wasn't, so they are essentially using different stat(2) structures. If 64-bit file offsets are used, the st_blocks member of struct stat grows to 64 bits and pushes the time members 32 bits "upwards". If you access this structure as a 32-bit stat structure from mod_php, st_atime contains garbage, st_mtime the access time and st_ctime the modification time of the 64-bit structure (voila!). The easy solution is to #define _FILE_OFFSET_BITS to 64, if Apache does (did) this. The hard part is that I don't know how to figure out if Apache uses 32 or 64 bits after it is installed. Secondly, PHP itself would have to use 64-bit stat structures, and I don't know if this might lead to more problems. So maybe it's better to transform the stat structure in mod_php? Any ideas? -- Edit bug report at http://bugs.php.net/?id=29451&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29451&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29451&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29451&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29451&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29451&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29451&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29451&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29451&r=support Expected behavior: http://bugs.php.net/fix.php?id=29451&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29451&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29451&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29451&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29451&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29451&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29451&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29451&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29451&r=float