@@ -492,19 +492,30 @@ the ``php.ini`` directive ``session.gc_maxlifetime``. The meaning in this contex
492492that any stored session that was saved more than ``gc_maxlifetime `` ago should be
493493deleted. This allows one to expire records based on idle time.
494494
495- However, some operating systems (e.g. Debian) do their own session handling and set
496- the ``session.gc_probability `` variable to ``0 `` to stop PHP doing garbage
497- collection.
495+ However, some operating systems (e.g. Debian) manage session handling differently
496+ and set the ``session.gc_probability `` variable to ``0 `` to prevent PHP from performing
497+ garbage collection. By default, Symfony uses the value of the ``gc_probability ``
498+ directive set in the ``php.ini `` file. If you can't modify this PHP setting, you
499+ can configure it directly in Symfony:
498500
499- You can configure these settings by passing ``gc_probability ``, ``gc_divisor ``
500- and ``gc_maxlifetime `` in an array to the constructor of
501+ .. code-block :: yaml
502+
503+ # config/packages/framework.yaml
504+ framework :
505+ session :
506+ # ...
507+ gc_probability : 1
508+
509+ Alternatively, you can configure these settings by passing ``gc_probability ``,
510+ ``gc_divisor `` and ``gc_maxlifetime `` in an array to the constructor of
501511:class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ NativeSessionStorage `
502512or to the :method: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ NativeSessionStorage::setOptions `
503513method.
504514
505515.. versionadded :: 7.2
506516
507- Starting from Symfony 7.2, ``php.ini ``'s directive is used as default for ``gc_probability ``.
517+ Using the ``php.ini `` directive as the default value for ``gc_probability ``
518+ was introduced in Symfony 7.2.
508519
509520.. _session-database :
510521
0 commit comments