note 59269 added to function.session-start

From: Date: Thu, 01 Dec 2005 06:46:55 +0000
Subject: note 59269 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-99399@lists.php.net to get a copy of this message
in responce to gadgetguy03 at lycos dot com SESSION LOST ON HEADER REDIRECT (CGI on IIS 5.0) and ma at technoprint dot ch I have the same server setup. I fought this for days. Then I realized that If I create the session with session_start() without setting any session variables on the page before I needed to set session variables and then do a redirect, everything magically worked. It was only when there was no session in existence that the following code would not work as expected. /***** sess1.php *****/ session_start(); $_SESSION["key1"] = "testvalue"; session_write_close() header("Location: sess2.php"); I've seen several post regarding this same issue, so I hope this is helpful. ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59269 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59269&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59269&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59269&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59269&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59269&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59269&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59269&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59269&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99399) next »