Is there any reason why a CakePHP 2 project won’t write session data to the database (MySQL)?
As per instructions here I’ve created a cake_sessions
table in the DB using:
CREATE TABLE 'cake_sessions' ( 'id' VARCHAR(255) NOT NULL DEFAULT '', 'data' TEXT, 'expires' INT(11) DEFAULT NULL, PRIMARY KEY ('id') );
I’ve also modified core.php
to reflect the following:
Configure::write( 'Session', [ 'defaults' => 'database', // Modify Session Timeout 'timeout' => 1440, 'cookieTimeout' => 1440, 'checkAgent' => false, 'autoRegenerate' => true, ] );
However, attempting to load pages produces session errors (failed to read session data) and no data is written to the DB.
I’ve carried out similar steps in CakePHP 3 projects and it works out of the box.
Any help here will be greatly appreciated.