@@ -492,27 +492,31 @@ 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. That's why Symfony now overwrites this value to ``1 ``.
498-
499- If you wish to use the original value set in your ``php.ini ``, add the following
500- configuration:
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:
501500
502501.. code-block :: yaml
503502
504503 # config/packages/framework.yaml
505504 framework :
506505 session :
507506 # ...
508- gc_probability : null
507+ gc_probability : 1
509508
510- You can configure these settings by passing ``gc_probability ``, `` gc_divisor ``
511- and ``gc_maxlifetime `` in an array to the constructor of
509+ Alternatively, you can configure these settings by passing ``gc_probability ``,
510+ `` gc_divisor `` and ``gc_maxlifetime `` in an array to the constructor of
512511:class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ NativeSessionStorage `
513512or to the :method: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ NativeSessionStorage::setOptions `
514513method.
515514
515+ .. versionadded :: 7.2
516+
517+ Using the ``php.ini `` directive as the default value for ``gc_probability ``
518+ was introduced in Symfony 7.2.
519+
516520.. _session-database :
517521
518522Store Sessions in a Database
0 commit comments