0

I'm following the following URL to set up sessions for user logins to multiple subdomains.

PHP Multi-Domain Sessions; ini_set Not Working?

I manage to get it working using the following format:

 ini_set('session.cookie_domain','.domain.com');
 session_start();

The problem now is that this only works at times on my subdomain.

When it doesn't work, sessions are not detected on xxx.example.com but are active on www.example.com.

I use a common login page from my main domain http://www.example.com/login so if sessions are detected on the main site, the login page wouldn't work as i do a header redirect to the main page whenever sessions are detected.

It will only work when i clear my browser cache, resetting all the sessions and try logging in again.

Anyone knows where the problem might be?

This affects my site overall User Interactivity. Any help will be appreciated.

Community
  • 1
  • 1
Lawrence
  • 717
  • 1
  • 12
  • 25

1 Answers1

0

You can try this code:

session_name("mss17");
session_set_cookie_params(0, '/', ".domain.com");
session_start();
ban17
  • 634
  • 8
  • 12