October 23rd, 2000, 03:13 PM
Can anybody help.
I've already written an application using the session management features in PHP 4.0.0. Everything works fine, except now I want to make the sessions last longer that one visit.
WinNT 4.0 w/ service pack 5.0
I thought I could do:
$one_month = 60*60*24*30;
session_set_cookie_params(time() + $one_month);
before I made the calls to session_start/register()
Unfortunatly, it doesn't work. It seems that the value in the php.ini always takes precedence, I'm running different sites on the same server all using php and therefore need to be independant of the php.ini file for this. session.cookie_lifetime was set to 0. So I changed it to nothing/undefined, and still the called to session_set_cookie_params() didn't seem to hold. Finally I tried to hardcode some time in the distant future like 2047 or something as the lifetime of the cookie in the php.ini file, and at least when I did this the session_get_cookie_params() would return an array with that number as the expire time. However, it didnt' seem to matter because the cookies still only hold a few minutes.
Is this because NT can't read the unix timestamp properly? Any other ideas?
October 24th, 2000, 04:49 AM
It can't be done this way, it will only result in
letting the PHPSESID cookie stay longer on the client
machine.. but it won't prevent that the garbage collector
deletes the session after a period of time that the session
hasn't been used.
It's not advicable to use one session over and over again.
there are a lot of disadvantages with that...
If u considerer storing data over multiple sessions, for example
personal background color for a site, then u could use a cookie
or you could store it in a database
October 24th, 2000, 11:30 AM
I've decided to set a cookie with the users login/password and restart a new session with each visit.