Session persists after closing browser

Username: epiz_29888944


I have a login system on my website and have run into a problem. I use sessions to store the users data while the session is active. I have noticed that the PHPSESSID cookie lasts for about 24 hours and will not be destroyed when closing the browser.

Is there any way to change this behavior or do I have to find a different solution?

Don’t use cookies, they can easily be altered. PHP sessions are a better alternative. An introduction is below.

1 Like

Could you possibly try this?

ini_set('session.gc_maxlifetime', 604800); // expires in 1 week

But as @Greenreader9 said, you should use sessions (and they are much easier to manage).


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.