CakePHP Cookie/Session problems

牧云@^-^@ 提交于 2019-11-27 20:08:37

Try adding the following to your core.php file:

Configure::write('Session.checkAgent', false);
Configure::write('Session.ini',array('session.cookie_secure' => false, 'session.referer_check' => false));

These parameters should force the cookie to persist even through Google Chrome Frame. This will set both PHP and CakePHP's settings to allow cookies to persist over http and https.

My suggestion is that you take a look at the packets directly, to see what is happening to the cookies.

Install Wireshark on your client machine, and connect to a remote web server. (Wireshark will ignore localhost traffic.)

My suspicion is that your cookies are either getting mangled (I once had some cookies mangled by PHP!) or they are stuck (which would be IE's fault). Either way, you will have more information about what's going wrong.

As a last resort, check the user-agent string in the code for the offending / unsupported version of IE, and urge people to upgrade.

panupan

Try putting this in your AppController's beforeFilter and see if it does anything. I have a feeling the cookie settings aren't configured like you need. See here for more info.

function beforeFilter() {
    $this->Cookie->domain = '.example.com';
    $this->Cookie->secure = false;
}

Have you made sure you don't have any spaces or newlines after closing php ?> tag? Perhaps it was the first thing you checked, but from experience I know that badly closed php tags does cause sporadic problems with php session handling.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!