Skip navigation

One of my bigger project requires me to setup personal sites on the main site’s subdomains. So i did what everyone would do and googled that.

It turned out to be quite simple. You just have to set session.cookie_domain to the domain of your site without www.

Like this session.cookie_domain = .mysite.com

Of course, you can set it with php using

1
ini_set("session.cookie_domain", ".localhost/mysite");

AND
You probably need to set cakephp security setting to medium or low. You can do that in core.php
Some people say medium is enough, but i needed to change minie to low in order for it to work.

2 Comments

  1. Hi
    I did that but how do I read this session data in another domain.

    Actually I set login session in the subdomain and want the main domain to read this session. How do I read that variable?

  2. the same way you would if you were in the same domain. $_SESSION['id']. if set up is right, they all share the same session. session data of all domains should be in $_SESSION.


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>