PHP session cookies in a subdomain using IE11/Safari
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_name("somename"); session_set_cookie_params(3600, '/folder/'); session_start();
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.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×