Skip to content

Different session garbage collector behavior between PHP 8.3 and PHP 8.5 #21314

@sebastien-jj

Description

@sebastien-jj

Description

Description

Hello,

We are observing a difference in the behavior of the file-based session garbage collector between PHP 8.3 and PHP 8.5, using the exact same configuration.

We are not sure whether the current behavior is expected or if this could indicate a regression, so we are seeking clarification.

Configuration (identical on both versions)

session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440

Observed Behavior

Under PHP 8.3 :

The number of session files in the storage directory stabilized around ~10,000 files.

Under PHP 8.5 :

The number of session files can grow to 120,000+.

Expired sessions appear to be cleaned much less frequently.

Traffic level and server environment are same.

Questions

Has there been any change in the session GC trigger logic between PHP 8.3 and PHP 8.5?

Has the probabilistic calculation (gc_probability / gc_divisor) changed?

Is there any documented change regarding file-based session handling?

PHP Version

PHP 8.5.3

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions