note 68418 deleted from function.session-start by peehaa
| From: | peehaa@php.net | Date: | Fri, 09 Dec 2016 22:03:18 +0000 |
| Subject: | note 68418 deleted from function.session-start by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208317@lists.php.net to get a copy of this message | ||
Note Submitter: devonmitton at gmail dot com
----
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]