Message-ID: <1118041587.2994.1485851542413.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2993_358824201.1485851542413" ------=_Part_2993_358824201.1485851542413 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Session

Session

Sessions are handled by the Symfony2 framework, specifically API= and underlying session handlers provided by HTTP Foundation comp= onent. This is further enhanced in eZ Platform with support for siteac= cess-aware sessio= n cookie configuration.

Use of Memcached (or experimentally using PDO) as session handler is= a requirement in Cluster setup, for details see below. For an overview of = clustering feature see Clustering

Session handlers

In Symfony, a session handler is configured using framework.sessio= n.handler_id. Symfony can be configured to use custom handlers, or just fallback to wh= at is configured in PHP by setting it to null (~).

Default configuration

eZ Platform uses the same default configuration as recent versions of Sy= mfony standard distribution. This makes sure you can configure sessions pur= ely in PHP by default, and allows Debian/Ubuntu session file cleanup cronjo= b to work as intended.

Default config.yml session configuration
=20
framework:
    session:
        # handler_id set to null will use default session handler from php.=
ini
        handler_id:  ~
=20

Recommendations for pr= oduction setup

Single server setup

For single server, default handler should be preferred.

Cluster setup

For Cluster setup we need to= configure Sessions to use a backend that is shared between web servers and= supports locking. Only options out of the box supporting this in Symfony a= re the native PHP memcached session save handler provided by the php-memcac= hed extension, and Symfony session handler for PDO (database).<= /p>

Storing ses= sions in Memcached using php-memcached

For setting up eZ Platform using this memcached you'll need to configure= the session save handler settings in php.ini as documented here, optionally tweak ph= p-memcached session settings.

Alternative= storing sessions in database using PDO

While not currently our recommendation from performance perspective, for= setups where Database is preferred for storing Sessions, you may use Symfo= ny's PdoSessionHandler.
Below is an configuration example for eZ Platfor= m, but please refer to documented in Symfony Cookbook documentation for full documen= tation.

=20
framework:
    session:
        # ...
        handler_id: session.handler.pdo

parameters:
    pdo.db_options:
        db_table:    session
        db_id_col:   session_id
        db_data_col: session_value
        db_time_col: session_time

services:
    pdo:
        class: PDO
        arguments:
            dsn:      "mysql:dbname=3D<mysql_database>"
            user:     <mysql_user>
            password: <mysql_password>

    session.handler.pdo:
        class:     Symfony\Component\HttpFoundation\Session\Storage\Handler=
\PdoSessionHandler
        arguments: ["@pdo", "%pdo.db_options%"]
=20

Further Symfony references

  1. Cookbook Session recipes (symfony.= com)
  2.  HTTP Foundation Co= mponent documentation (symfony.com)
  3. Source code of NativeFileSessio= nHandler (github.com)
  4. Cookbook Confi= guration recipe for setting-up PdoSessionHandler (symfony.com), aka&nbs= p;session.handler.pdo service

 

------=_Part_2993_358824201.1485851542413--