session.cookie_domain and sub-subdomains

Discussion in 'PHP' started by Triexa, Sep 9, 2009.

  1. #1
    So I have this:
    ini_set('session.cookie_domain', '.mydomain.com');

    and it appears to be working just fine across abc.mydomain.com and xyz.mydomain.com. HOWEVER, it does NOT seem to be working with sub.abc.mydomain.com or sub2.xyz.mydomain.com.

    Will that work with sub-subdomains, or only the level one below it (subdomain)?

    Would really love to know if this is in fact the problem or I somehow have another problem lurking around! :(
     
    Triexa, Sep 9, 2009 IP
  2. phprightnow

    phprightnow Peon

    Messages:
    296
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You probabley have to enable it for each subdomain, that way their subdomains will be covered.

    Example:
    ini_set('session.cookie_domain', '.mydomain.com') will work for *.mydomain.com
    ini_set('session.cookie_domain', '.abz.mydomain.com') will work for *.abz.mydomain.com
     
    phprightnow, Sep 9, 2009 IP
  3. Chemo

    Chemo Peon

    Messages:
    146
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Read up on session_set_cookie_params()
     
    Chemo, Sep 10, 2009 IP