PHP - Session destroy after closing browser
cookies, php, session
Solution
The best way is to close the session is: if there is no response for that session after particular interval of time. then close. Please see this post and I hope it will resolve the issue. "How to change the session timeout in PHP?"
Problem
Though this question has multiple duplicates i could not find proper solution for me. Need Some help. I have used `ini_set('session.cookie_lifetime', 0);` in my configuration file. But it is not helping me to destroy session on browser close. Application current flow: 1) In authentication page if user is valid, generate new session identifier using `session_regenerate_id(true);` 2) Control goes to welcome.php where i start new session using `session_start();` 3) in logout page code is ``` $_SESSION = array(); if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } // Finally, destroy the session. session_destroy(); ```