S
S
Sergey2014-12-01 18:21:35
MySQL
Sergey, 2014-12-01 18:21:35

What could be wrong with storing yii 1 sessions in the database?

Good day to all.
The project on yii 1, we implement the storage of sessions in the database. It turns out that each time the site is accessed, a new entry is added to the session table. I noticed when I called the SetFlash method, the variable was written to the session (this is visible in the database), but it’s impossible to read it, because a new record for the user has been created. With what it can be connected?
Table code in the database:

CREATE TABLE `wo_yiisession` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `expire` INT(11) NOT NULL,
  `data` TEXT NOT NULL,
  PRIMARY KEY (`id`),
  INDEX `expire_idx` (`expire`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB

Sessions component code in main.php config:
'session' => array(
            'class' => 'CDbHttpSession',
            'connectionID' => 'db',
            'sessionTableName' => 'wo_yiisession',
            'timeout' => 3600 * 24 * 30,
            'autoStart' => 'false',
            'cookieMode' => 'only',
        ),

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Ezhgurov, 2014-12-11
@eandr_67

What the hell is INT with autoincrement??? Have you looked at the documentation on CDbHttpSession at least once? There it is written in black and white what types the fields of the session storage table should have. The id field stores the php's session identifier and therefore must be of type CHAR(32) .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question