Page 1 of 1

session variable across subdomain

Posted: Thu Jan 28, 2010 7:14 am
by prue_
hi, can someone help me.. I have a login form that uses session variables.. It's working perfect with folder based.. how can I make it work with the subdomain.. the subdomain don't recognize the session I set.. here's the code on my subdomain page

Code: Select all

 
code deleted
 
this is a snip of code from domain/index (with the login form)

Code: Select all

 
code deleted
 
I tried to google it and find this:
will this code helps? don't know where to place this though

Code: Select all

ini_set("session.cookie_domain",".domain.com") ;
thanks a lot, I hope someone can help me.. I'm starting to go crazy, I've been doing this for hours already.

Re: session variable across subdomain

Posted: Thu Jan 28, 2010 8:40 am
by requinix
Edit your php.ini and change the cookie_domain there.

Don't forget to restart the web server.

Re: session variable across subdomain

Posted: Thu Jan 28, 2010 9:12 pm
by prue_
where can I find php.ini? will this solve my problem?
thanks!

Re: session variable across subdomain

Posted: Thu Jan 28, 2010 9:30 pm
by requinix
prue_ wrote:where can I find php.ini?
phpinfo can tell you.
prue_ wrote:will this solve my problem?
I wouldn't have suggested it if I thought otherwise.

Re: session variable across subdomain

Posted: Fri Jan 29, 2010 12:09 am
by flying_circus
You should also be able to change the value in your script at runtime using ini_set("session.cookie_domain", "myDomain"); Be sure to change the value BEFORE you start your session.

Re: session variable across subdomain

Posted: Mon Feb 01, 2010 8:42 pm
by prue_
thanks to both of you.. @tasairis, I shouldn't have said that.. :)

but can't find it in ftp.. the path says /usr/local/lib/php.ini.. am I not supposed to find it in ftp? where else could it be?

thanks again