On 5/4/07 9:23 AM, "Chris Shiflett" <[EMAIL PROTECTED]> wrote:

> Hi Paul,
> 
>> Our client wants sessions to time out after six hours of
>> inactivity, and I'm wondering if there's an easy way to do
>> that by configuring PHP.
> 
> Yes, but keep in mind that session.gc_maxlifetime indicates a maximum,
> not a minimum. PHP isn't going to check on every request to see whether
> it should clean up stale sessions; there's some probability involved.
> However, you can change that, too. :-)
> 
>> $now=time();
>> if(isset($_SESSION["timestamp"])) {
>>    ... dump session if now-timestamp > limit ...
>> }
>> $_SESSION["timestamp"]=$now;
> 
> Seems like a fine way to do it to me.
> 
> Chris

Why not kill the GC function and add a cron job instead? More predictable,
less overhead.

Cliff


_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to