2

I setup my session timeout in CakePHP to be very long due to a business need, I configured it on core.php like this:

Configure::write('Session', array(
    'defaults' => 'php',
    'timeout' => 4320, //minutes
    '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
    'ini' => array(
        'session.gc_maxlifetime' => 259200 // 3 day seconds
    )
));

I make some tests on local server and in production server and I see some differences:

Local development environment (PC)

1 hour: successfull (session not closed)

2 hour: successfull (session not closed)

4 hour: succesfull (session not closed)

Production server

1 hour: successfull (session not closed)

2 hour: Not successfull (session closed)

I need to be able to have big timeouts (4 hours minimum) on the production server, why I have this differences between the local PC and the server?

Vito
  • 718
  • 4
  • 16
  • 37
  • I'm having the same problem. Have you found a solution to this yet? – Leah Aug 24 '16 at 14:19
  • Not yet, still looking for a solution. – Vito Aug 24 '16 at 15:29
  • Oh, I see. I've been trying out different things for days now too and still no good. Please let me know if you find any solution. I'll let you know likewise. Thanks! – Leah Aug 25 '16 at 00:34

1 Answers1

1

This is because your web host has different PHP configuration. You can check using phpinfo() about the Session expire time.

You can set it using PHP ini

axcl
  • 410
  • 6
  • 21