1

I add this code for close browser destroy session.

This code works fine Mozilla, Opera but doesn't work in Chrome.

I also set session.cookie_lifetime = 0 in php.ini file.

ini_set('session.cookie_lifetime', 0);  
session_set_cookie_params(0);

session_start();
amphetamachine
  • 27,620
  • 12
  • 60
  • 72
Manish Jesani
  • 1,339
  • 5
  • 20
  • 36
  • you must either access it via IP `127.0.0.1` or set the cookie domain parameter to the empty string. – Ghostman Apr 02 '15 at 12:38
  • possible duplicate of [Chrome doesn't delete session cookies](http://stackoverflow.com/questions/10617954/chrome-doesnt-delete-session-cookies) – tutankhamun Apr 02 '15 at 13:34

1 Answers1

-1

Change sequence of session

session_start(); 
session_set_cookie_params(0);
Manish Jesani
  • 1,339
  • 5
  • 20
  • 36
  • 1
    This effectively uses the default cookie settings. Using session_set_cookie_params() after session_start() is a no-op. -1 for usefulness. – Dandorid May 15 '20 at 08:56