alamnaryab
alamnaryab

Reputation: 1484

cakephp session timeout not working

I have cakephp site, I was having problem that was after being idle for about >= 1 hour it gets log-out automatically
so I googled to extend timeout for that I wrote the following in core.php

    Configure::write('Session', array(
        'defaults' => 'php',
        'timeout'  => 28800,  // 8 hours.
        )
    );

I want to keep a logged in user logged-in even after being idle for less than 8hours
but this is not working
how can I sort out this?

Upvotes: 1

Views: 1938

Answers (3)

Rafael Caro
Rafael Caro

Reputation: 26

I had the same problem in CakePHP 1.3

The problem was that CakePHP was using the settings defined in php.ini instead of the one I was defining in core.php

So I had to change in core.php:

Configure::write('Session.save', 'php');

to

Configure::write('Session.save', 'cake');

And it worked like a charm!

Upvotes: 0

Asim Inayat Butt
Asim Inayat Butt

Reputation: 11

May be you are using CakePHP 3, that is why you are facing this issue. Session timeout does not work in CakePHP 3, You might use cookie_lifetime, please check https://github.com/cakephp/cakephp/issues/5664

Upvotes: 1

ericj
ericj

Reputation: 441

According to CakePHP manual, the unit of Session.timeout option is "minute", so 8 hours should be 60*8=480

Regarding the setting not work, I think maybe you could try to clean the cakePHP cache files / restart web server or change the debug level to 2 for troubleshooting?

CakePHP 2.0 manual sessions

Upvotes: 1

Related Questions