views:

31

answers:

1

Hello! I have a problem with writing cookies in cakephp and even don't know how to debug it or where too look for a clue.

I've inherited a project where cookie were only created using the Session component, of course i added 'Cookie' to $components array in app_controller and put this in beforeFilter:

$this->Cookie->name = 'foo';
$this->Cookie->path = '/home/~nick'; 
$this->Cookie->domain = 'hostname';   
$this->Cookie->secure = false;  //i.e. only sent if using secure HTTPS
$this->Cookie->key = 'some key';

and in some action i use:

$this->Cookie->write('key', 'value');

I access page by http://hostname/home/~nick/foo and actually try to put even something so silly. I doesn't work. I would be really gratefully for any clue where to search problem. Thanks!

A: 

Your domain value was probably wrong making the cookie unavailable. Leaving it blank probably defaults to the current domain.

Galen
Thanks, during the deployment i'll try setting different domains (localhost, vhosts etc.) and see what is happening.
radious