note 68418 added to function.session-start

From: Date: Wed, 26 Jul 2006 08:35:49 +0000
Subject: note 68418 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-115203@lists.php.net to get a copy of this message
I ran into the problem of losing the session after i redirect the user with header( location:); I found that the problem doesn't occur in php5. Atleast for myself. I tested it on IIS as well as Apache and both times using php5 fixed the issue. Secondly, I found a weird solution: The website i'm building required Cyrillic type, so i encode the pages using UTF-8. The problem that happens is that UTF-8 sends information before the php tags, and therefore before the session_start(); which ultimately renders the session_start(); call ineffective. The UTF-8 encoding sends a small chunk of information before anything. This is called BOM (byte order marks). To ensure that they don't show up, you need to save your files with a UTF-8 encoding which bypasses BOM. BBEdit for the Macintosh with allow for this under the file encoding options. To recap: In this instance and for my situation, UTF-8, no BOM will allow sessions to pass through the header( location:); redirect, or using PHP5. Hope this helps someone! [i will also repeat this comment under the header() function] ---- Server IP: 66.163.161.117 Probable Submitter: 24.76.127.146 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/note/edit/68418 Del: integrated -- http://master.php.net/note/delete/68418/integrated Del: useless -- http://master.php.net/note/delete/68418/useless Del: bad code -- http://master.php.net/note/delete/68418/bad+code Del: spam -- http://master.php.net/note/delete/68418/spam Del: non-english -- http://master.php.net/note/delete/68418/non-english Del: in docs -- http://master.php.net/note/delete/68418/in+docs Del: other reasons-- http://master.php.net/note/delete/68418 Reject -- http://master.php.net/note/reject/68418 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#115203) next »