CodeIgniter Forums
PHP sessions expire after X minutes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: PHP sessions expire after X minutes (/thread-73501.html)



PHP sessions expire after X minutes - peter - 05-01-2019

Hello,

Since few days, I have a problem with my sessions with codeigniter.
They expire after approximately 16/17 minutes. Nothing change in my code and everything was working good before.

Sessions are generated like this :

PHP Code:
$this->session->set_userdata('user'$username); 

My autoload.php :

PHP Code:
$autoload['libraries'] = array('database''session'); 

My config.php :

PHP Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE

My phpinfo (PHP Version 7.2.17) :

[Image: screen.png]

I guess there is a problem with the my config server.

Do you have any idea ?


Thank you Smile


RE: PHP sessions expire after X minutes - adamoli - 05-02-2019

Since your sess_save_path is set to NULL in your config, the sessions are being stored in the path defined by php settings (session.save_path).

You may consider changing this to a path you control and have access to.
There may be some server process cleaning this folder periodically.

I would set sess_expiration and sess_time_to_update to 0 for testing purposes, and change the sess_cookie_name to something else.

Also, check your cookie settings as these may also affect session behavior.