Skip to content

Commit 4dc0dac

Browse files
MicWitxabbuh
authored andcommitted
Update session_configuration.rst
Required changes to garbage collection documentation as it was out of date. Note that this is my first time editing and I had a look at the instructions, but some things may not be quite correct as the preview didn't seem to work properly. I didn't download the files and edit, I used the online editor. I also wasn't sure about links to other parts of the doc, but may be worth having a link to http://symfony.com/doc/current/reference/configuration/framework.html#gc-probability where I edited.
1 parent 3fb9087 commit 4dc0dac

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

components/http_foundation/session_configuration.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ the ``php.ini`` directive ``session.gc_maxlifetime``. The meaning in this contex
139139
that any stored session that was saved more than ``gc_maxlifetime`` ago should be
140140
deleted. This allows one to expire records based on idle time.
141141

142+
However, because some operating systems do their own session handling and have set the ``session.gc_probability`` variable to 0 (to stop PHP doing garbage collection), Symfony now overwrites this value to a value of 1.
143+
144+
If you wish to use the value set in your PHP.ini, you would need to add the following configuration:
145+
146+
.. code-block:: yaml
147+
148+
# config.yml
149+
framework:
150+
session:
151+
gc_probability: null
152+
142153
You can configure these settings by passing ``gc_probability``, ``gc_divisor``
143154
and ``gc_maxlifetime`` in an array to the constructor of
144155
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage`

0 commit comments

Comments
 (0)