There is session data being saved on sub.domain.com
and I'd like to use that data in domain.com
.
I confirmed that they both have the same session save path (by echoing ini_get('session.save_path')
in both)
I've tried putting ini_set('session.cookie_domain', '.sub.domain');
on domain.com but that didn't work. (I have also removed the preceding .
).
I also tried adding session_set_cookie_params(0, '/', '.domain.com');
in front of each session_start()
, but that didn't work either.
I would like to be able to use the $_SESSION
data in domain.com
from what is set in sub.domain.com
.
What can I do for this to work?
Thanks!
$_SESSION['domain']
(where 'domain' is interchangeable in the session_name('domain')
function.)adding the following to each file fixed this:
session_name("domain");
session_set_cookie_params(0, '/', '.domain.com');
session_start();
Does anyone know why re-naming the session fixes this? It's that first line that made this all work.