August 10, 2014

August 10, 2014
In this article, we are going to discuss about How to use database for session in CakePHP version 1.3.3. In CakePHP 1.3.3, I had difficulty in finding the schema for the sessions table without using the command line to generate the table.

Below is the raw SQL, that can be used to create the table. I'm sure it will be useful in future for me so I thought I'd share.

CREATE TABLE `cake_sessions` (
  `id` varchar(255) NOT NULL DEFAULT '',
  `data` text,
  `expires` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)

Now you just need to modify the core.php file so that the database is used for Sessions instead of the default:

Configure::write('', 'database');


To create the Sessions table from the console simply navigate to the /cake/console directory in the command line and run:

php cake.php schema create Sessions


Post a Comment