views:

763

answers:

1

This is my first time on StackOverflow though I "read" Coding Horror quite often. Anyway...

I'm working on a school/college project using CakePHP and I'm using the built in AuthComponent to support user Authentication (i.e. logging in, etc).

My problem is that it logs me out after very short intervals. It doesn't even have me wait a full session (i.e. closing browser). Sometimes 5 minutes, sometimes 10 and occasionally 15 but not more.

Worst is when it logs me out when I'm calling a method that requires a user to be logged in and it decides to die right before than.

I've searched quite a bit but I can't seem to find an answer. Any help will be appreciated!

+1  A: 

I haven't used CakePHP since version 1.1, so I am not sure if this has changed, but you may want to check out your DEBUG level. The lower the DEBUG setting, the lower the value assigned to CAKE_SESSION_TIMEOUT. In 1.1, again, this is all determined in app/config/core.php.

EDIT: Just checked it out, it's been rewritten but the idea remains the same. In core.php look for:

/**
 * Session time out time (in seconds).
 * Actual value depends on 'Security.level' setting.
 */
Configure::write('Session.timeout', '120');

And increase it so that it takes longer to timeout the session.

Paolo Bergantino
Ah good point. Mine is at level 1 (for testing). Is there anyway I can increase `CAKE_SESSION_TIMEOUT` without changing the debug level?Thanks!
royrules22
Well ignore my previous comment. Your edit works!
royrules22
Yeah, I just updated my answer. Just increase that number.
Paolo Bergantino
Yep increased it to 720 and with my Security.level settings it gives me 2 hours. Good enough for a school thing.
royrules22