Page 1 of 1
PHP Sessions - Not Destroying
Posted: Mon Nov 17, 2008 10:21 am
by Sjwdavies
Hi guys.
I've got a fresh Apache/PHP installation, and it was my impression that when using start_session(), the PHP session expired when the browser was closed?
However, it appears the sessions still stay active. I'm writing an online insurance quote application and want the session to be destroyed if the user gets part way through a quote but then closes the window.
Am I missing something really obvious?
Any help is greatly appreciated.
Re: PHP Sessions - Not Destroying
Posted: Mon Nov 17, 2008 11:41 am
by VladSun
php.ini
session.cookie_lifetime integer
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().
Note: The expiration timestamp is set relative to the server time, which is not necessarily the same as the time in the client's browser.
Re: PHP Sessions - Not Destroying
Posted: Wed Nov 19, 2008 10:17 am
by Sjwdavies
Thanks for the reply.
I've checked that already, it's set to zero.
Here's what my ini file has
; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0
Any ideas?
Re: PHP Sessions - Not Destroying
Posted: Fri Nov 28, 2008 8:23 am
by novice4eva
viewtopic.php?f=1&t=90176
I am not sure about the session expiring thing when the browser is closed!! I read a thread saying the same but i just couldn't believe it coz i had never experienced it, so i tried to change the session "THING" in the php.ini and could finally get the session destroyed on browser close and even page refreshes but that was coz i set the session.use_cookies to 0 and then forgot to send the session id as the get parameter

Re: PHP Sessions - Not Destroying
Posted: Fri Nov 28, 2008 1:03 pm
by airy
function session_destroy() doesn't work well in lower version of php
please make sure your php version, U may found more information about that in php manual