session valid in other sub-domain

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

Mon Sep 02, 2002 11:30 pm

I've got a couple of sites running on different subdomains, but the same domain.
something like this:

When I start a session in one of those, that session is only valid in that session. How do I make the session valid for the entire "" domain?? so that variables in the session are available in all subdomains?

Greetz Daan


Wed Sep 25, 2002 6:46 am

nobody got any idea??

problem should be solved when the cookie, wich the session automaticly sets, appears in every subdomain.
so if I start a session in and then go to the cookie set by the first session appears there.

Greetz Daan


Wed Sep 25, 2002 7:28 am

Just found it out myself:

Code: Select all

$cookie_settings = session_get_cookie_params();
session_set_cookie_params ($cookie_settings['lifetime'],'/','');

This will make the session work throughout any subdomain you want.
lifetime stays the same this way.

Great monologe if I may say so myself ;) :mrgreen:

Greetz Daan

Post Reply