![]() |
Session data is slow to update on production server - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Session data is slow to update on production server (/showthread.php?tid=81222) |
Session data is slow to update on production server - agahwibisana - 02-06-2022 Hi, i've been looking for the solution to a session-related problem online but still not find any. I'm using CI 4.1.8 and this is the server info on production: cPanel Version 100.0 (build 7) Apache Version 2.4.52 PHP Version 7.4.27 MySQL Version 5.7.37 Architecture x86_64 Operating System linux Path to Sendmail /usr/sbin/sendmail Path to Perl /usr/bin/perl Perl Version 5.16.3 Kernel Version 3.10.0-962.3.2.lve1.5.52.el7.x86_64 They are working just fine in the dev server (localhost). Dev server uses same Apache and PHP version as production server. The issue: -I put $this->session = \Config\Services::session(); on BaseController. i call $this->session-> on controllers with no issue. -When i do a login function and check whether username/pwd is correct, i set to session the username and set flashdata for login success notification and do redirect to homepage. -I have menu section where if username is set it shows profile link, when not set it shows signup/login link. -It works correctly on localhost, the redirected page contains flashdata and username is stored in session. when i click refresh immediately after, the flashdata disappear as intended and the menu changes accordingly. -However, on production, when i click refresh immediately after redirect, the flashdata still persists. i have to wait around 10-15 seconds and hit refresh before changes in session is reflected. -I try session_destroy(), and it's the same. i have to wait around 10-15 seconds and hit refresh before any changes related to session data is reflected. I don't understand this behavior and since there's no error i don't know where to look at my code/setting. Can someone help? many thanks. RE: Session data is slow to update on production server - InsiteFX - 02-07-2022 Did you try session_write_close() ? RE: Session data is slow to update on production server - agahwibisana - 02-07-2022 It turned out a server issue. I don't know why but by default my hosting provider disables "nginx bypass cache" feature. when i enable it, the app behaves like in localhost. kind of weird because in the server info it show Apache (or maybe i wasn't understanding it correctly). mark as solved~ RE: Session data is slow to update on production server - jahngalt - 02-18-2022 (02-07-2022, 03:57 AM)agahwibisana Wrote: It turned out a server issue. I am having an issue likewise yours. Maybe I need to do something in server configurations? I use Apache |