简体   繁体   中英

Session get destroyed before authTimeout expire in yii2

In Yii2,I have in my config/main.php

'components' => [
    'user' => [
        'identityClass' => 'common\models\User',
        'authTimeout' => 43200,
        'loginUrl' => null,
    ],
...
]

when i am trying to see my authTimeout variable in my whole system is ok and everything works fine except my session get expire before authTimeout.I am using access_token for login because my frontend is angular and also using mdmsoft/yii2-admin for RBAC. And i am not getting,why i am logging out before my authTimeout?
Thanks

It is probably because globally, session.gc_maxlifetime is set to be lower than what you have set in your application. You can use echo ini_get("session.gc_maxlifetime"); to get the current value.

This answer discusses how to increase that within your application. Note, that some hosts tend to override the session timeout value set in php.ini, as discussed in this thread . Even if that is the case, this answer would help.

If this is not the case, then please provide more information about your script, host and php configuration. I will update the answer accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM