Re: Changing Session Timeout

From: Date: Fri, 27 Apr 2007 09:24:33 +0000
Subject: Re: Changing Session Timeout
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-253958@lists.php.net to get a copy of this message
On 4/27/07, Aaron Axelsen <lists@frozenpc.net> wrote:
I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')."/myapp"; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen lists@frozenpc.net
session_set_cookie_params requires the number given in seconds, which you did correct. But session_cache_expire requires the number given in minutes. and session.gc_maxlifetime is in minutes again. So that is correct too. you could try replace this: session_cache_expire($mytimeout); with: session_cache_expire($mytimeout / 60); That should fix it, if not, just come back, but then tell us what exactly is wrong, does the session timeout too early? does the session timeout too late? does the session timeout never? Tijnema

« previous php.general (#253958) next »