solarisuser Posted August 22, 2007 Share Posted August 22, 2007 Hi All, If I leave my PHP session open, walk away, and come back an hour later, my app logs me out and I need to relogin. Do I need to modify /etc/php.ini and change some value? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/66231-php-session-seems-to-die-after-a-certain-period-of-time/ Share on other sites More sharing options...
trq Posted August 23, 2007 Share Posted August 23, 2007 That is normal behavour. Session do not last forever.... I think default is 20 mins. If you want a more persistant login, you will need to use cookies. Quote Link to comment https://forums.phpfreaks.com/topic/66231-php-session-seems-to-die-after-a-certain-period-of-time/#findComment-331936 Share on other sites More sharing options...
solarisuser Posted August 24, 2007 Author Share Posted August 24, 2007 Would forcing a refresh of the page every couple minutes prevent the auto-logout behavior? Quote Link to comment https://forums.phpfreaks.com/topic/66231-php-session-seems-to-die-after-a-certain-period-of-time/#findComment-333330 Share on other sites More sharing options...
trq Posted August 24, 2007 Share Posted August 24, 2007 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/66231-php-session-seems-to-die-after-a-certain-period-of-time/#findComment-333504 Share on other sites More sharing options...
markjoe Posted September 1, 2007 Share Posted September 1, 2007 While I think it's a better idea to handle persistent logins with cookies and DB entries... I believe you could simply change the default expiration time of the session cookie. ; Whether to use cookies. session.use_cookies = 1 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 Quote Link to comment https://forums.phpfreaks.com/topic/66231-php-session-seems-to-die-after-a-certain-period-of-time/#findComment-339217 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.