php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14837 getlastmod() returning file access time, not modification time
Submitted: 2002-01-03 22:11 UTC Modified: 2002-01-27 01:15 UTC
From: wls at wwco dot com Assigned:
Status: Closed Package: Directory function related
PHP Version: 4.1.0 OS: Linux Slackware, kernel 2.4.16
Private report: No CVE-ID: None
 [2002-01-03 22:11 UTC] wls at wwco dot com
I've just upgraded to PHP 4.1.0 and I have code on my site (Linux/Apache) that displays when the page was last modified:

<? echo(date("d-M-Y H:i:s", getlastmod() )); ?>

This used to work like a champ.  However, I noticed after upgrading that the date/time stamp it displays is that of the last _access_, not modification.

Thus, I'm *expect* the date as shown by:
  $ ls -l index.php
Instead, I'm *seeing* the date as shown by:
  $ ls -lu index.php

I didn't notice it in the bug-fix list for PHP 4.1.1.  I didn't see it in the PHP Reported Bug List.

-Walt Stoneburner,
 wls@wwco.com

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-27 01:15 UTC] sterling@php.net
Works fine in CVS.
 [2003-05-20 06:19 UTC] ffyk3s at home dot se
It also seems that getlastmod() doesn't work under Novell with Apache 1.3.27 and PHP-4.2.4-dev (the latest available), might be worth checking out...
 [2003-06-10 20:40 UTC] mf22cs at student dot hik dot se
I don?t see how the status could be "closed".

My ISP runs:
PHP 4.3.1
Apache 1.3.27
Slackware Linux 2.4.18

And the problem remains. I don?t get the correct timestamp out of getlastmod() until i do a "touch filename".

/Marcus Farrington
mf22cs_at_student_dot_hik_dot_se
 [2004-01-19 00:44 UTC] abest at digitalflex dot net
Something else is wrong here, I have this problem on only one system running 4.3.4, the others work correctly.
 [2004-01-19 01:12 UTC] abest at digitalflex dot net
Hmm, seems sapi_get_stat is returning the wrong thing. 

I have this problem with Apache 1.3.26(debian).

I've checked this with "php test.php" and it is correct, it is the current time through apache.

No problems with Apache/2.0.47 (Fedora).
 [2004-05-12 16:48 UTC] meteor_ at web dot de
I recently had the same problem. It worked fine long before but then I set up some virtual hosts. Since then getlastmod() reports wrong modification times.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Apr 12 13:01:23 2021 UTC