PHP session cookies in a subdomain using IE11/Safari

December 21, 2014 881 views

I'm losing the session between redirects in both Internet Explorer 11 and Safari (works fine on Chrome, Opera and Firefox).

When I try to login using www.subdomain.domain.com the error occurs on IE/Safari, but even on them it works fine if I use the IP (xxx.xxx.xxx.xxx/folder).

I'm trying to setup the session like:

session_set_cookie_params(3600, '/folder/');

I have already tried:

session_set_cookie_params(3600, '/folder/', '.domain.com);
session_set_cookie_params(3600, '/folder/', '.subdomain.domain.com);
session_set_cookie_params(3600, '/folder/', 'domain.com);  <-- without the preceding dot
session_set_cookie_params(3600, '/folder/', 'subdomain.domain.com);
ini_set("session.cookie_domain", ".domain.com"); <-- before set_cookie_params

But none of them seems to work.

1 Answer

I am not able to speak to Safari but IE11 and Edge have removed some cross domain functionality intentionally. More information about this change can be found here and here.

Have another answer? Share your knowledge.