Session too early with CakePHP 2.0

I recently switched to Cake2.0, and I had problems with session timings much earlier than they should.

Having copied the example from the documentation , I set the session type in php and set the timeout to 3 days (4320 minutes). However, after reading various articles, it seems that even after setting a timeout of up to 3 days in Cake, PHP can destroy a session in GC if PHP.ini is set with a shorter timeout for the session or GC.

So, I changed the default value for the default for the cake with the same timeout.

Configure::write('Session', array( 'defaults' => 'cake', 'timeout' => 4320, )); Configure::write('Security.level', 'medium'); 

However, although this should leave me logged in for 3 days, I think I can barely make it 3 hours before I need to log in again.

Is there a problem with the session timeouts that I should be aware of, or is it a timeout in seconds (not minutes?), Or does it depend on the Security.level level, as in 1.3? I could not find documentation on how this works in version 2.0 or what might cause problems.

Thanks in advance.

Answer: For those who come later and see this. In 2.0.5 there is an error when the session timeout did not save the value in Config.write ();

To solve, upgrade to 2.0.6 (or 2.1 when it leaves beta)

+4
source share
1 answer

If you use a security component, you can always try changing its expiration date to 3 hours:

 $components = array( 'Security' => array( 'csrfExpires' => '+3 hour' ) ); 

I'm not saying this is a good idea, but it can help you narrow down the problem. If you are using the Security component, this is probably the problem.

In addition, Session.timeout is in minutes (not seconds).

+1
source

Source: https://habr.com/ru/post/1396392/


All Articles