PHP session destroyed / lost after header

Posted by ILMV on Stack Overflow See other posts from Stack Overflow or by ILMV
Published on 2010-01-10T14:42:20Z Indexed on 2010/04/21 16:13 UTC
Read the original article Hit count: 252

Filed under:
|
|

I've got a script that sets some session values before redirecting to / using header().

I've read many posts about the $_SESSION variable being destroyed / lost after header(), even after I implemented this:

// set session here

session_regenerate_id(true);
session_write_close();
header("Location: /");

session_start() is set in the correct places, does anyone know of anything that I might be missing?

On the index.php page I have this:

session_start();
print_r($_SESSION);

// outputs nothing :'(

The code is pretty complex so will not post it all, just snippets.

© Stack Overflow or respective owner

Related posts about php

Related posts about session