Linux, PHP: Differences between File Modification Time: filemtime() and File Change Time: filectime()

In most Unix file systems, the modification time and the change time of a file may not necessarily be the same, they are actually 2 very distinct concepts to deal with:

  1. File modification time represents when the data blocks or content are changed or modified, not including that of meta data such as ownership or ownergroup.
  2. File change time represents the time when the meta data or inode data of a file is altered, such as the change of permissions, ownership or group.

Accordingly, PHP function filemtime() returns the time the content is modified or updated while function filectime() returns the time when the meta data is updated or changed.

When you need to display a web page last modification time, for example, you should use filemtime() because you want to show the time when the page content is updated.

Scroll to Top