0

Codeigniter storing session data in database

Codeigniter storing session data in database

Codeigniter storing session data in database. In Codeigniter by default session store in the files that is not good in the security point of view. we can not store bulk data in session. If we want to store more data we need to find the alternative solution for that, so the alternative solution is that store session in the database. Codeigniter have natively avaliable this, we can easily store the session in database we just need to do some config changes.

First Create a database table

After creating the database table now you just need to open config.php file and in this file you need to enable database for session and also specify the table name.following are the setting for config.php file.

Now you go to the autoload.php, and add “session” to the drivers element:

Sandeep Kumar

Sandeep kumar is a web developer and a professinal blogger. He works for latest technologies and write articles what he learn. In ICodeHub he share web languages tutorials and other programming tips and tricks. if you need some help or have some suggestion then mail him at sandeep92pal@gmail.com without any hesitation. He believes in learning and sharing.