@@ -492,27 +492,31 @@ the ``php.ini`` directive ``session.gc_maxlifetime``. The meaning in this contex
492
492
that any stored session that was saved more than ``gc_maxlifetime `` ago should be
493
493
deleted. This allows one to expire records based on idle time.
494
494
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:
501
500
502
501
.. code-block :: yaml
503
502
504
503
# config/packages/framework.yaml
505
504
framework :
506
505
session :
507
506
# ...
508
- gc_probability : null
507
+ gc_probability : 1
509
508
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
512
511
:class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ NativeSessionStorage `
513
512
or to the :method: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ NativeSessionStorage::setOptions `
514
513
method.
515
514
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
+
516
520
.. _session-database :
517
521
518
522
Store Sessions in a Database
0 commit comments