Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter session size limit

When storing the session in the database via

$config['sess_use_database']    = TRUE;

Is the size of the data limited to the size of the user_data field which is TEXT ... ? Not 4kb like a normal cookie.

like image 409
ringerce Avatar asked Jul 22 '11 20:07

ringerce


1 Answers

To further clarify my comment above, when you elect to save the session data in a database, CodeIgniter doesn't set a cookie (other than the session id of course) but saves all of the information that it would have set in a cookie in your database.

If you have a look at the sess_write in the Session class located in ./system/libraries/, if you have enabled the use of a database, you'll see that it serializes the data using serialize and saves it directly to the database. There is no restriction on length imposed by CodeIgniter when saving to a database.

For your convenience, here's a link to the source code: https://bitbucket.org/ellislab/codeigniter/src/fe2247a927ab/system/libraries/Session.php#cl-252.

The only restriction is set by the field you chose to use to save the data in your database. For more information on the data type storage requirements of MySQL, read this.

like image 199
Francois Deschenes Avatar answered Sep 23 '22 14:09

Francois Deschenes