我正在使用Cake的内置auth模块。在我的生产环境中一切正常。但是在我的本地环境中,我无法登录。我发现问题是因为会话似乎在每次重定向时重置。因此,蛋糕无法在会话变量中找到其中一个数组(Config)。
我尝试将安全级别设置为中/低,但没有用。
请帮忙。
这是我的会话对象的样子:
SessionComponent Object
(
[__active] => 1
[__started] => 1
[__bare] => 0
[valid] => 1
[error] => Array
(
[2] => Config doesn't exist
[1] => Session is valid
)
[_userAgent] =>
[path] => /
[lastError] => 1
[security] => low
[time] => 1278498179
[sessionTime] => 1282098179
[watchKeys] => Array
(
)
[id] =>
[_log] =>
[host] => localhost
[enabled] => 1
[cookieLifeTime] => 788940000
)
答案 0 :(得分:0)
好的。我解决了它与我在本地环境中的文件夹权限有关。 我希望这篇文章可以帮助别人。
答案 1 :(得分:0)
这也可能是因为您的网站是从其他服务器或电子邮件链接加载的。
One common problem is if the link you are following is from a different HOST the php session has a session.referer_check which is set to the HTTPS_HOST for security high and to HTTP_HOST for security medium, it is not set for security low. This causes the session to be reset if the referer is not the host that is being called. In other words if you followed a link from an email or some other server that points to your app. This also presents when going back and forth between the root app/domain and a root/sub app/domain because the the HTTP_HOST can changes (if one site is using blah.blah.com and the other is using localhost or ip address) Often we all have code to read in a cookie to remember a user that has previously logged in. This often just masks and hides the problem. So we don't notice most of the time when the session was dropped until we start to rely on a saved value that we thought we saved to the session or when the user cookie expires and we are redirected to the login page. So these often times appear very random when in reality they are not. If your having what appears to be intermediate session lost, its very likely its occurring more than you think. Some debugging is needed.
我可以在安全媒体和安全媒体之间确定唯一的区别 安全性低是超时持续时间并设置php session.referer_check。
来源:http://cakephp.1045679.n5.nabble.com/Auth-losting-authentication-with-no-reason-td1331403.html
希望这可以帮助有需要的人。