Hello,

Is it possible to share cakePHP sessions (stored in the database) across subdomains?
This thing - ini_set("session.cookie_domain", ".mydomain.com"); seems not to be working in this case.

Thanks

Member Avatar for LastMitch

Is it possible to share cakePHP sessions (stored in the database) across subdomains?

This single code is correct:

ini_set("session.cookie_domain", ".mydomain.com");

You need more than just that 1 line in order to have session stored in the database across subdomain.

Beside that you also need these 2 new session in cakePHP:

http://book.cakephp.org/2.0/en/appendices/new-features-in-cakephp-2-0.html#cakesession-sessioncomponent

Plus you also need add a cookie code:

http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html

After you implement the code it should work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.