Skip to content

why my sessiosn are not working in codeigniter 3?

I am using codeigniter-3 for developing the web part, i am using sessions for maintaining the user data once the user login if i click on any page or button the page is redirect to the login page.

i have two projects of codeigniter-3 if i launch the project-1 in browser and login with credentials it’s navigating to the another page it’s working fine,but in project-2 it’s not working but same session configurations of both project-1 and project-2.

i am facing one strange scenario if user is login in project-1 and at a same time if user has login in project-2 in same browser the page redirections are working fine in project-2 .i tried with many solutions over the google nothing works for me can you please help me to fix this issue..?


The page should navigate one page to another page instead of redirecting to login page


$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
// $config['sess_save_path'] = NULL;
$config['sess_save_path'] = '/tmp';

$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;


$userdata = array(
                        'id'    =>$response_arr['data']['id'],
                        'user_id'  => $response_arr['data']['user_id'],
                        'role'      => $response_arr['data']['user_id'],



In order to resolve your issue we have to dive in to the project,anyway I was thinking in your project might be some checks like is_logged_in or user_logged_in as true because of this the page is return back to the login screen.

You have to add one more key value pair in $userdata array.before that you must have to verify in other page controllers which check they add according to that you have to add key value pair like the following

$userdata=[is_logged_in =>TRUE];

Please let me know if this resolve your issue.

User contributions licensed under: CC BY-SA
9 People found this is helpful