Overriding session length in existing session?

From: Date: Thu, 03 Mar 2011 22:58:52 +0000
Subject: Overriding session length in existing session?
Groups: php.general 
Request: Send a blank email to php-general+get-311651@lists.php.net to get a copy of this message
I have a global header.php file that sets up a bunch of stuff: DB, global variables, and does session_start(). My header.php looks like this: #header.php $cookie_life = (86400 * 7); // Cookies last for seven days session_set_cookie_params($cookie_life,"/",".domain.com",true); session_start(); This is called globally in *all* my scripts. In another script I'd really like to set the session to expire after the browser closes if a uses clicks "public terminal" or something. I thought I could just set the session cookie to expire after the browser closes. Can I override the already started session by doing something like this in my index.php: #index.php include('header.php'); setcookie(session_name(), '', 0 ,"/",".domain.com"); When I do this the session expires IMMEDIATELY. I must be missing something?

« previous php.general (#311651) next »