2010-07-07 70 views
0

我正在使用Cake的內置驗證模塊。我的生產環境一切正常。但是在我的本地環境中,我無法登錄。
我發現問題是因爲會話似乎在每次重定向時都被重置。由於這個蛋糕無法在session變量中找到它的一個數組(Config)。
我曾嘗試將安全級別設置爲中/低,但沒有用。

請幫忙。cakephp「Config doesnt exist」in session

這是我的會話對象的樣子:

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

這也可能是因爲您的網站是從其他服務器或電子郵件鏈接或其他東西加載的。

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

希望這可以幫助別人需要的人。