Is there a way to make a php session span through my www.domain.com as well as sub.domain.com??? just using session_start()
and $_SESSION['foo'] = "bar"
does not work...any suggestions? the PHP manual does not say anything about it.
Thanks
Is there a way to make a php session span through my www.domain.com as well as sub.domain.com??? just using session_start()
and $_SESSION['foo'] = "bar"
does not work...any suggestions? the PHP manual does not say anything about it.
Thanks
you can try setting the cookie domain
ini_set("session.cookie_domain", ".domain.com");
this will set all sub domains within the domain.com to be see as the one domain
The default session tracking in PHP relies on cookies (PHPSESSID, by default, if memory serves).
You can set the domain using session_set_cookie_param() (but you must do so before calling session_start(), I think) -- or you can set it in php.ini, or .htaccess like:
php_value session.cookie_domain ".domain.com"
Check out this question.
I'm sure there are other answers, but you could use session_set_save_handler
to store your sessions in a database. http://www.php.net/manual/en/function.session-set-save-handler.php