A
A
Alexander Antonov2015-05-05 19:05:54
Yii
Alexander Antonov, 2015-05-05 19:05:54

How to stop Yii2 from deleting cookies?

Bottom line: Yii2 deletes all cookies and sessions after a while, although the lifetime is 3600*24*30*12 - which is confirmed when viewing cookies in the browser. Removes both PHPSESSID and any others on the domain
My config:

'session' => [
            'class' => 'yii\web\Session',
            'cookieParams' => ['httponly' => true, 'lifetime' => 3600*24*30*12],
            'timeout' => 3600*24*30*12,
            'useCookies' => true,
        ],
'request' => [
            'enableCookieValidation' => false,
            'enableCsrfValidation' => true,
            'cookieValidationKey' => 'секретка',
        ],

Validation turned off. I tried to ask via setcookie directly. I couldn’t track the moment of deletion, but it comes some time after the client’s inactivity, about 20 minutes.
I also found out that all cookies are deleted if you manually delete PHPSESSID.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question