简体   繁体   中英

CodeIgniter Session getting destroyed

I have two codeigniter applications running on a single server, sharing same database. They have been configured with db session driver storing individual sessions in different tables

for eg: for app1 it is Table ci_session_app1 and app2 it is Table ci_session_app2

config for app1

$config['sess_driver'] = 'database';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions_app1';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

config for app2

$config['sess_driver'] = 'database';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions_app2';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I am trying to login in both the apps on same browser window, the problem that occurs is when i sign in app1, and proceed to signing in on app2, a successful app2 login logs' out the user from app1. The vice versa also stands true.

Also, When i logout from one of the apps ( app1 for instance ), the other app (app2) also results a logout for the user.

I read a few articles on internet about CI session issues with too many Ajax requests, but i doubt mine is a similar case to that. Can someone give any pointers ?

My CI version is 3.1.5 ( as seen in CodeIgniter.php file from Core )

只需在配置文件中为每个应用设置单独的encryption_key

$config['encryption_key'] = 'app_enc_key';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM