NYCPHP Meetup

NYPHP.org

[nycphp-talk] Session cookie expiration issue

Stephen Musgrave stephen at musgrave.org
Thu Mar 9 10:47:43 EST 2006


> Have you tried plain sessions sans adodb?  If not, you might want  
> to check
> to be sure sessions are working properly on your php setup before  
> you put
> too much time digging into the library.

I haven't brought myself to that point yet because I've been hoping  
it is something obvious.  It seems to me that it isn't so much  
session as it is the session ID cookie.  The expiration date on the  
cookie is always the original value when set - it never changes.   
Yes, maybe that is a problem with the manager (ADODB) but something  
this basic seems unlikely?  I'm still thinking that *I* have done  
something wrong in how I have set up the config.

> Check out your phpinfo().
> Look for session.gc_maxlifetime.
> It defaults at 1440 (in seconds = 24 minutes)

This looks good, in fact I am using
ini_set("session.gc_maxlifetime", 1800);
and php info shows that the override is being picked up.

> "session.cookie_lifetime specifies the lifetime of the cookie in  
> seconds
> which is sent to the browser. The value 0 means "until the browser is
> closed." Defaults to 0. See also session_get_cookie_params() and
> session_set_cookie_params(). "

Ah, now we're onto something.  I found the problem.  I did something  
pretty lame and when using the session_set_cookie_params() function  
(so I could set secure cookies), I set the first parameter to the  
session time maxlifetime instead of 0.

Thank you all for your suggestions!

Thanks,

Stephen

…………………………………………………………………………………
     email:    stephen at musgrave.org
     web:        http://stephen.musgrave.org/career
     office:       917.721.3378


More information about the talk mailing list