|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29451 getlastmod() returns access time - solution
Submitted: 2004-07-30 01:36 UTC Modified: 2004-08-23 19:16 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: robert at rw-it dot net Assigned:
Status: Wont fix Package: Apache related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
39 - 2 = ?
Subscribe to this entry?

 [2004-07-30 01:36 UTC] robert at rw-it dot net
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?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-23 19:16 UTC]
The problem is that normal (module) PHP build only involves 
Apache headers which do not appear to provide this 
information. Consequently PHP cannot perform the check you 
have mentioned. 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Sep 20 05:01:26 2019 UTC