Session expiration not working |
Hello,
Thanks for this forum : ) Sorry to be quite a beginner in CodeIgniter, which I use for only 3 weeks. For several days now I'm trying to make my CodeIgniter session expire in more than 2 hours, but I definitively don't find how to do that. First thing I should say is that my session works well, but only for maybe 2 hours, and then disappears. In App.php I've replaced PHP Code: public int $sessionExpiration = 7200; by PHP Code: public int $sessionExpiration = 60 * 60 * 24 * 15; // 15 days (and then, just in case, by PHP Code: public int $sessionExpiration = 1296000; // 15 days In my BaseController, I have : PHP Code: namespace App\Controllers; And then, in my Controllers, I use PHP Code: $this->session->set() PHP Code: $this->session->get() I also tried to switch from PHP Code: public string $sessionDriver = FileHandler::class; to PHP Code: public string $sessionDriver = MemcachedHandler::class; but it did not change anything. Does anyone know why it doesn't work (either in my local server xampp or my online website) ? If no idea, should I try Cookie instead, and if yes does someone has a good tutorial because I've searched how to do it properly for more than 1 hour (including https://codeigniter.com/user_guide/libra...okies.html), without success (I know I'm probably bad, sorry...). Thanks a lot to anybody who will try to help me
What is your problem?
What does not work? The sessions still expire in 2 hours or so? You should not call PHP Code: $this->session->start() because PHP Code: \Config\Services::session($config) And you don't need to pass $config if you use the default values in \Config\App. PHP Code: public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
I did not see your reply, sorry. Thanks.
I've solved the problem by editing the App/Config/Session.php file. |
Welcome Guest, Not a member yet? Register Sign In |