Re: PHP sessions expiring early
| From: | Paul Waring | Date: | Wed, 07 Sep 2011 11:00:20 +0000 |
| Subject: | Re: PHP sessions expiring early | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314725@lists.php.net to get a copy of this message | ||
On 07/09/11 11:47, Nilesh Govindarajan wrote:
On 09/07/2011 03:50 PM, Paul Waring wrote:Yes, I'm aware of that. However, users are being logged out after a few minutes, not one hour of inactivity (which is what I'd expect with 3600 seconds).I'm having trouble with a PHP website which requires users to be logged in to access all content other than the home page and a couple of static pages (about us, contact us etc.). Several users have said they are being logged out every few minutes whilst using the site - they can login but will be shown the login form again after a few minutes. I can't confirm this myself as the site seems to work fine for me - even using the same browser as they are and under their accounts - but I'm wondering if this could be a problem with the session settings?You have set gc_maxlifetime to 3600 seconds. How much expire time have you set? Because, every 3600 seconds, session data stored is considered as garbage and php clears them out itself.
If your expiration time is more than 3600 seconds, then this will not work. You need to increase gc_maxlifetime.If you mean the expiration time of the session cookie, it is set to 0, which means it shouldn't be deleted until the browser is closed (or the user logs out, at which point it is deleted immediately). Paul -- Paul Waring http://www.phpdeveloper.org.uk