sc1013
sc1013

Reputation: 1126

PHP Session Cookie Not Being Cleared On Browser Close

The following occurs on Chrome, but works perfectly on IE.

a.php

<?php
session_start();
$_SESSION['name1'] = 'value1';

b.php

<?php
session_start();
echo $_SESSION['name1'];

After running a.php, I closed the browser and opened a new Chrome window to run b.php. I was surprised it displayed value1.

The problem is why the session is still alive when I close the browser? How to fix it? I want the session being killed when the browser closed.

Upvotes: 1

Views: 635

Answers (1)

Joakim Nohlg&#229;rd
Joakim Nohlg&#229;rd

Reputation: 1852

Since it works in IE I would guess the problem in Chrome is because of this feature/design choice:

http://code.google.com/p/chromium/issues/detail?id=128513

Especially comment#2 is relevant. Do you have "Continue where I left off" activated in Chrome settings?

Upvotes: 1

Related Questions