php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66159 fileatime() only returns file creation date, not file accessed.
Submitted: 2013-11-23 15:21 UTC Modified: 2014-01-05 23:53 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: webzuru at yahoo dot com Assigned: ab (profile)
Status: Not a bug Package: Filesystem function related
PHP Version: Irrelevant OS: Windows 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webzuru at yahoo dot com
New email:
PHP Version: OS:

 

 [2013-11-23 15:21 UTC] webzuru at yahoo dot com
Description:
------------
fileatime() function is supposed to return 'last access time of the given file' however, in windows that is not the case. It only returns the date when the file was created. This may be related to windows file permission issue, which should be worth mentioning in the documentation. 

Test script:
---------------
<?php 
 
  /*
   * this only returns the date the file was created. 
   */  
  var_dump(date('d', fileatime('foo.txt'))); 
  //string '13' (length=2)
  

Expected result:
----------------
I expect to see date in which the file was last accessed or modified. 

Actual result:
--------------
21

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-05 23:42 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2014-01-05 23:42 UTC] ab@php.net
That's obviously has nothing to do with PHP, but with the system settings and filesystem type. The relevant settings you can check with the commando

fsutil behavior query DisableLastAccess

Be sure it's set to 0, to change run cmd as admin and invoke

fsutil behavior set DisableLastAccess 0

By default updating the atime was disabled in Vista AFAIR. Also note that the atime has 1 hour resolution on NTFS.

Cheers
 [2014-01-05 23:53 UTC] ab@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC