Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share session storage between codeigniter projects

There are two different projects which have developed on codeigniter. I want to share session storage between these projects. $config['sess_cookie_name'] = 'ci_session'; config file is same in both. But when I refresh one of them, all data automatic remove from another project. I can't solve this problem. #help

like image 702
Farhad Misirli Avatar asked Oct 04 '17 07:10

Farhad Misirli


1 Answers

Store sessions in a central database; use the same session table for different projects.

See https://codeigniter.com/user_guide/libraries/sessions.html#database-driver

Addendum:

Codeigniter (CI) employs a number of ways to store sessions. Flat file, database, Redis etc. Default is flat file; ie; stores session data within the filesystem.

It is also possible to store the sessions in database tables. This method facilitates both multi server and multi project installations.

application/config/config.php does have a section named "Session Variables".

$config['sess_driver'] = 'database'; <- use database

$config['sess_save_path'] = 'ci_sessions'; <- use this table

shared usage of this table for session storage among different projects will solve the problem.

like image 92
Kagan Kongar Avatar answered Nov 07 '22 18:11

Kagan Kongar