Sharing PHP session from subdomain to TLD -


there session data being saved on sub.domain.com , i'd use data in domain.com.

i confirmed both have 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 didn't work. (i have removed preceding .).

i tried adding session_set_cookie_params(0, '/', '.domain.com'); in front of each session_start(), didn't work either.

i able use $_session data in domain.com set in sub.domain.com.

what can work?

thanks!


update: figured out (at least 1 way) of how this, not sure why answer works. guess question be, why renaming session name solve this? using same session cookie domain (?) makes more sense me.
seems setting domain creates new session $_session['domain'] (where 'domain' interchangeable in session_name('domain') function.)

adding following each file fixed this:

session_name("domain"); session_set_cookie_params(0, '/', '.domain.com'); session_start(); 

does know why re-naming session fixes this? it's first line made work.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -