I'm wondering how PHP detects that a specific session has timed out.

In detail: I'm using the default (file based) session handler, with a default session lifetime and so on. Everything in php.ini is on default.

If now a session is started, PHP does a check (depending non session.gc_divisor and session.gc_probability) if there are any timed out sessions. But from where does get PHP the last session access time from the sessions to check against?

The session file itself contains only the workload, e.g. x|i:1; for a $_SESSION['x'] = 1;, so there is no information about the last session access time.

I think that there are no in-memory information related to session start times as the sessions are still working after a full server restart.

So, where does PHP get the information from? Is it comparing the mtime/ctime of the session file?

Edit
Report