Re: Changing Session Timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I now have the following settings:

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);

// New Attempt
session_cache_limiter();
session_cache_expire($mytimeout / 60);
ini_set('session.gc_maxlifetime', $mytimeout / 60);
#ini_set('session.gc_probability',1);
#ini_set('session.gc_divisor',1);

session_start();

I logged in and then left the computer untouched for an hour.  When I
came back the session was timed out, and I was required to login. 
Something still isn't working right.  Any ideas?  I have checked the
settings using phpinfo() and confirmed that the values are in fact being
set by the above commands.

-- Aaron


Tijnema ! wrote:
> On 4/27/07, Aaron Axelsen <lists@xxxxxxxxxxxx> 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@xxxxxxxxxxxx
>>
>
> 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
>

-- 
Aaron Axelsen
lists@xxxxxxxxxxxx

Great hosting, low prices.  Modevia Web Services LLC -- http://www.modevia.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux