session problem

Discussion in 'PHP' started by dizyn, Dec 19, 2009.

  1. #1
    Hi

    I have sub domains on my site and i wanted to use one session across subdomains but i can't.. I am using following code but it's not working

    Can anyone tell what's the reason??

    Here is my code:

    session_set_cookie_params(3600,'/','.domain.com');
    PHP:
     
    dizyn, Dec 19, 2009 IP
  2. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can use normal session on the sub domain
     
    astkboy2008, Dec 19, 2009 IP
  3. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #3
    dizyn, your code is correct. It should work.
    I'm not sure where did you put session_start but it should have been as follows...

    
    session_set_cookie_params(3600, '/', '.domain.com');
    session_start();
    
    PHP:
     
    mastermunj, Dec 19, 2009 IP
  4. dizyn

    dizyn Active Member

    Messages:
    251
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Can you please tell me what i need to enable in httpd config file or php.ini file?

    Thank you!!
     
    dizyn, Dec 19, 2009 IP
  5. ghprod

    ghprod Active Member

    Messages:
    1,010
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    78
    #5
    hmmmm ... maybe u can create one file php as key to manage session then just include this file in all subdomain using absolute path (maybe relative?) :)

    regards
     
    ghprod, Dec 19, 2009 IP
  6. dizyn

    dizyn Active Member

    Messages:
    251
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #6
    it's already done
     
    dizyn, Dec 19, 2009 IP