Top of Cool
You are in a maze of twisty passages, all alike.
-
How to set the session path for CakePHP sessions
Posted on May 15th, 2008 3 commentsI had an issue where my CakePHP app (which was part of a larger webapp) was setting its own cookie_path for ‘/cakeapp’, which was the location of Cake. Meanwhile, the session for the general app, with cookie_path at ‘/’ was also setting up its own session. So, I needed Cake to use ‘/’ for its session.cookie_path instead of defaulting to the Cake app’s path.
The simplest way to do this for me was to set Session.start to false in core.php. Then, I added a $this->Session->activate(‘/’); to my app_controller.php in a beforeFilter() function. Now, the Cake app is using ‘/’ for it’s session.cookie_path.
h/t AD7six in #cakephp for showing me this.