Table of Contents
Cake comes preset to save session data in three ways: as temporary
files inside of your Cake installation, using the default PHP mechanism,
or serialized in a database. By default, Cake uses PHP's default
settings. To override this in order to use temp files or a database,
edit your core configuration file at
/app/config/core.php. Change the CAKE_SESSION_SAVE
constant to 'cake', 'php', or 'database', depending on your
application's needs.
Example 16.1. core.php Session Configuration
/**
* CakePHP includes 3 types of session saves
* database or file. Set this to your preferred method.
* If you want to use your own save handler place it in
* app/config/name.php DO NOT USE file or database as the name.
* and use just the name portion below.
*
* Setting this to cake will save files to /cakedistro/tmp directory
* Setting it to php will use the php default save path
* Setting it to database will use the database
*
*
*/
define('CAKE_SESSION_SAVE', 'php');
In order to use the database session storage, you'll need to
create a table in your database. The schema for that table can be found
in /app/config/sql/sessions.sql.