Session expiring before expiration period. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Session expiring before expiration period. (/showthread.php?tid=71458) |
Session expiring before expiration period. - alan1o - 08-16-2018 My sessions seem to be expiring before their expiration period. I've researched this quite a lot and am unable to resolve it. I thought may it was down to Asynchronous ajax calls (session race condition) so I extended the session class via MY_Sesssion.php to only regenerate the session if it's not an AJAX call. I've included both that function and my config below. I'm using CI version 3.1.7 PHP Code: class MY_Session extends CI_Session { Config: PHP Code: $config['sess_expiration'] = 7200; //= 2 hours RE: Session expiring before expiration period. - rhodium - 08-16-2018 Does your server/PHP time have the same timezone as your MySQL Database? RE: Session expiring before expiration period. - alan1o - 08-17-2018 Hi rhodium, thanks for the response. MySQL global time zone is UTC, session time zone is Europe/London. PHP date_default_timezone_set: Europe/London date.timezone: Europe/London So yes, I believe so. RE: Session expiring before expiration period. - Susan Burling - 08-17-2018 You can follow this link https://stackoverflow.com/questions/5500516/codeigniter-user-session-keeps-expiring this may help you. RE: Session expiring before expiration period. - alan1o - 08-17-2018 (08-17-2018, 07:18 AM)Susan Burling Wrote: You can follow this link https://stackoverflow.com/questions/5500516/codeigniter-user-session-keeps-expiring this may help you. Appreciate the help, but have already read that. This is essentially my last port of call as I've googled it to death. RE: Session expiring before expiration period. - alan1o - 08-29-2018 Just following on from this. I believe this is my issue: https://github.com/bcit-ci/CodeIgniter/issues/154 Originally only on AJAX calls, but I can reproduce the issue by session sess_time_to_update to a low value, and opening several tabs which causes simultaneous requests. RE: Session expiring before expiration period. - dave friend - 09-04-2018 (08-29-2018, 04:12 AM)alan1o Wrote: Just following on from this. I believe this is my issue: https://github.com/bcit-ci/CodeIgniter/issues/154 Have you tried using session_write_close() as described in the session documentation "A note about concurrency"? It's a singularly useful call inside ajax requests. |