0

I'm pretty new to Cakephp. I'd like my sessions data gets expired in 3 days. However, it seems like the expiration time is just a few hours, as when the user logs in, s/he will be logged out in a few hours.

Here is all the changes I have made in core.php:

I added timeout parameter:

Configure::write('Session', array(
        'defaults' => 'php',
        'timeout' => 4320   
    ));

I checked most of the relevant questions and none of the solutions worked for me:

Changing 'timeout' to 'session.timeout', changing 4320 to '4320' and ,...

Thanks for you help in advance. :)

shabk
  • 51
  • 1
  • 9
  • Well, just based on the time it keeps the user logged in. After a few hours (not sure how many hours) it logs out the user because cache is expired. I will change the engine to File to see if that is the problem. BTW, is there any way for me to check the expiration time of the cache? – shabk Jun 13 '14 at 23:15
  • `I checked most of the relevant questions` <- if you don't link to what you've read and explain or demonstrate what happens when trying the solution - there's no reason to think that any found duplicate isn't applicable to this question. All that said, IMO you're better off implementing remember-me cookies than having overly long session timeouts. – AD7six Jun 14 '14 at 15:13
  • It seems like I mixed up cache with sessoin. Sorry about that. I just updated my question. Login in my code has nothing to do with cache. It's all implemented using session. – shabk Jun 14 '14 at 19:46
  • AD7six: I will increase gc_maxlifetime and see what happens. Thank you all for your help. :) – shabk Jun 14 '14 at 19:49

1 Answers1

0

You can use below code for same:

Configure::write('Session', array(
    'defaults' => 'php',
    'timeout' => 30, // The session will timeout after 30 minutes of inactivity
    'cookieTimeout' => 1440, // The session cookie will live for at most 24 hours, this does not effect session timeouts
    'checkAgent' => false,
    'autoRegenerate' => true, // causes the session expiration time to reset on each page load
));

Read more here

Community
  • 1
  • 1
Aditya P Bhatt
  • 21,431
  • 18
  • 85
  • 104