cakePHP Session expiring too soon

送分小仙女□ 提交于 2019-12-11 18:19:39

问题


I have set Configure::write('Security.level', 'medium'); to low, set Configure::write('Session.timeout', '120'); to higher numbers, and in cake/libs/security.php I have set the inactiveMins() function to the following,

function inactiveMins() {
    switch (Configure::read('Security.level')) {
        case 'high':
            return 10;
        break;
        case 'medium':
            return 100;
        break;
        case 'low':
        default:
            return 550;
            break;
    }
}

But sessions are still expiring at around 120 minutes. This is a time tracking app so I would like to have the functionality of leaving the app running in the background until needed. But the session closes too soon. Is there another way to leave the session open for hours at a time since these options aren't working?

From APP/CONFIG/CORE.PHP ***

/**
 * Session time out time (in minutes).
 * Actual value depends on 'Security.level' setting.
 */
    Configure::write('Session.timeout', '120');

Core version 1.3.4


回答1:


This is the standard setting:

/**
* Session time out time (in seconds).
* Actual value depends on 'Security.level' setting.
*/
Configure::write('Session.timeout', '120');

I always change it to something like:

Configure::write('Session.timeout', 120 * 60);



回答2:


php.ini file was overriding cake settings. Changed Configure::write('Session.save', 'php'); to Configure::write('Session.save', 'cake'); in app/config/core.php



来源:https://stackoverflow.com/questions/8331379/cakephp-session-expiring-too-soon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!