0

I wonder why each refresh of the page of the website I'm writing, or moving between different pages, creates new session record (I'm storing them in DB instead of using standard solution). In other words, each single click (I'm not using JS / AJAX) creates new record / new session.

Here's my configuration of sessions in config file:

session:
    lifetime:       7200
    domain:  MY_SERVER
    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:            HOST
        user:           USER
        password:       PSWD

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

I tried to use:

    auto_start:     false

But I'm getting then the following error from Symfony2.1:

    The auto_start setting is deprecated. Just remove it from your configuration file.

So what should I do to have normal sessions?

UPDATE I also used the following:

    arguments:
      - "mysql:host=%database_host%;dbname=%database_name%"
      - %database_user%
      - %database_password%

that is, my basic Data Base settings for whole project (stored in parameters.yml).

4

1 に答える 1