Sessions are handled by the Symfony framework, specifically API and underlying session handlers provided by the HttpFoundation component. It is further enhanced in eZ Platform with support for SiteAccess-aware session cookie configuration.
Symfony offers the possibility to change many session options at application level
(i.e. in Symfony
These options include:
However, in eZ Platform you can set up several sites within one Symfony application, so you can also define session configuration per SiteAccess and SiteAccess group level.
Session options per SiteAccess¶
All site-related session configuration can be defined per SiteAccess and SiteAccess group (in
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
In Symfony, a session handler is configured using
Symfony can be configured to use custom handlers, or just fall back to what is configured in PHP by setting it to null (
eZ Platform uses the same default configuration as recent versions of Symfony standard distribution. This makes sure you can configure sessions purely in PHP by default, and allows Debian/Ubuntu session file cleanup cronjob to work as intended.
1 2 3 4 5
Recommendations for production setup¶
For a single server, the default handler is preferred.
For a cluster setup you need to configure sessions to use a back end that is shared between web servers and supports locking.
The only options out of the box supporting this in Symfony are the native PHP Memcached session save handler
provided by the
php-memcached extension, and Symfony session handler for PDO (database).
Storing sessions in Memcached using
To set up eZ Platform using Memcached you need to configure the session save handler settings in
and optionally tweak
php-memcached session settings.
Storing sessions in Redis using pecl package¶
To set up eZ Platform using the Redis pecl package
you need to configure the session save handler settings in
Alternative storing sessions in database using PDO¶
For setups where database is preferred for storing sessions, you may use Symfony's PdoSessionHandler, although it is not currently recommended from performance perspective.
Below is a configuration example for eZ Platform. Refer to the Symfony Cookbook for full documentation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23