Sessions and Subdomains

Hey,

I’m having a bit of trouble with maintaining sessions across my subdomain. I’ve tried to search for help on it but I’ve found nothing that seems to work. My site is running from test.example.com, when i want to login I go to test.example.com/login and log in. As a note, when i enter this address ‘www.’ gets automatically added to the url and I’m left with http://www.test.example.com/login/. I log in and and everything executes as it should, the login is recorded to the active session and i get redirected back to the main page, http://test.example.com. However, when i check the session there is no record of the login.

I’m pretty sure that one session was created for http://www.test.example.com and another for http://test.example.com. I’ve tried things like session_set_cookie_params(“86400”, “/”, “.example.com”); but this isn’t working, more than likely because I’m using it wrong.

Can anyone tell me what i should be doing?

Thanks for any help,

Mike

Sponsor our Newsletter | Privacy Policy | Terms of Service