I had a cookie-free subdomain (static) until I used this code to make my session variable visible in all sub-domains:
session_set_cookie_params(0,'/','.example.com');
apparently, By doing so, I have lost cookie-free characteristic of the "static" subdomain.
How could I have one session variable visible in all subdomains except the static one? thank you for helping
I was having similar problem as you, and I think my solution will help you for your cookie-less static domain. I've described my issue and subsequent solution below so hopefully you can use it to solve your issue.
I wanted to share the session on 2 subdomains:
But exclude that session, and use its own session on
To set the session to be used across the two domains, as you described you will have to set the cookie params:
session_set_cookie_params(0,'/','.example.com');
However, this will conflict with the cookie for the admin.example.com session.
The solution is to set the session name in the admin site so it differs to the session name in the other sites. For example:
session_name("AdminPHPSESSID");
See http://www.php.net/session_name for more info.