php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16630 getlastmod() returns file access time, not modification time
Submitted: 2002-04-16 05:39 UTC Modified: 2002-08-14 20:01 UTC
Votes:5
Avg. Score:4.0 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:2 (40.0%)
From: johan at ekenberg dot se Assigned:
Status: Closed Package: Apache related
PHP Version: 4.1.2, 4.3.0-dev OS: Linux, glibc 2.2.3
Private report: No CVE-ID: None
 [2002-04-16 05:39 UTC] johan at ekenberg dot se
This is similar to http://bugs.php.net/bug.php?id=14837 which was discarded with a "works in CVS". I'm not so sure it's solved that easily.

Example page here:
http://www.ekenberg.se/php_getlastmod/getlastmod.php
The example shows the output from getlastmod() compared to "ls -l" and "ls -lu". There's also a link to phpinfo().

The bug only appears when using PHP as an Apache module. When running from the commandline the file modification time is shown correctly.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-04 22:11 UTC] matslin at orakel dot ntnu dot no
I've been browsing around trying to look for a cause of this behaviour... Currently its working like it should, both under Apache 1.3.24 / (current CVS head) (as module), under Apache 1.3.23 / (CVS from 9. March) (compiled static). It does however seem broken in Apache 2.0.35 (probably since apache2filter doesnt provide path_translated in the request_rec (or something, i'm not an apache2-expert or very used to the php-source)).

Could you try compiling the current CVS and see if you're still experiencing this problem? I did get the same results as you got earlier (with 4.2.0 under Apache 2.0.35 (yes, i noticed you're running 1.3.23)), but after makeing and make installing the fresh version from cvs, i now get just a 'false' instead.


I have the following test pages:
Apache 1.3.23/PHP CVS from march
http://home.e-mats.org/test-getlastmod.php

Apache 1.3.24/Current CVS HEAD
http://home.e-mats.org:809/test-getlastmod.php

Apache 2.0.35/Current CVS HEAD
http://home.e-mats.org:808/test-getlastmod.php

The source (which pretty much should be explained from the page:
http://home.e-mats.org/test-getlastmod.phps

One more thing, if you could just try to use filemtime() with the same file, you would probably get the right results.
 [2002-05-09 08:27 UTC] johan at ekenberg dot se
I've built (statically) the latest snapshot (php4-200110220000 from snaps.php.net) with apache-1.3.24, and the results are exactly the same. Example here: http://www2.aname.net/~johan/getlastmod/getlastmod.php

filemtime() works correctly as you suggest.
 [2002-06-11 18:34 UTC] jerry dot zhao at vanderbilt dot edu
Different platform, same problem.

Apache 1.3.24
PHP 4.1.2
Solaris 7 / Sun Sparc server
gcc 2.95.2
 [2002-06-18 04:51 UTC] derick@php.net
It's an apache thing... as it works fine in CGI mode.
 [2002-06-30 18:57 UTC] chrisken at ncs dot utexas dot edu
Running:
Apache 2.0.39
PHP 4.2.1 ( as a DSO )

This is still a bug in getlastmod(), and I have created another small test case page to show this bug:

http://www.utacm.org/extra/getlastmod.php
 [2002-08-14 20:01 UTC] iliaa@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

This works fine with Apache 1.3.20/1.3.26 & PHP 4.3.0-dev. If the bug does exist it is in the Apache code and not PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 23:01:26 2024 UTC