Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Session garbage collection configuration #8053

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/_includes/config/locate-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,25 @@ The preceding example stores session files in `/var/www/session`
### `php.ini` example {#session-where-phpini}

As a user with `root` privileges, open your `php.ini` file and search for the value of `session.save_path`. This identifies where sessions are stored.

## Garbage collection configuration {#session-gc}

To clean up expired sessions, Magento calls the `gc` (_garbage collection_) handler randomly according to a probability that is calculated by the `gc_probability / gc_divisor` directive. For example, if you set these directives to `1/100` respectively, it means a probability of `1%` (_probability of one call of garbage collection per 100 requests_).

The garbage collection handler uses the `gc_maxlifetime` directive—the number of seconds after which the sessions will be seen as _garbage_ and potentially cleaned up.

On some operating systems (Debian/Ubuntu), the default `session.gc_probability` directive is `0`, which prevents the garbage collection handler from running.

You can overwrite the `session.gc_` directives from the `php.ini` file in the `<magento_root>/app/etc/env.php` file:

```php
'session' =>
array (
'save' => 'db',
'gc_probability' => 1,
'gc_divisor' => 1000,
'gc_maxlifetime' => 1440
),
```

The configuration depends on the traffic and specific needs of a certain Magento application.