本地安裝magento1.9版本,安裝好後在登陸後臺的時候都遇到了點問題,magento後臺登陸不了,用戶名和密碼都輸入正確,就是magento登陸不了後臺,經過研究發現,登陸不了magento後臺主要是因爲magento自身緩存設置的問題,解決方法如下:
magento登陸不了後臺可以嘗試以下幾種方法解決:
打開文件 app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
找到代碼:
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);
替換爲:
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath() ,
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly() );
這些是在網上找到的,有幾個版本的magento這樣做過之後問題就解決了,但是還有的這樣設置過後仍登陸不了後臺,於是繼續找原因,終於在magento論壇裏看到如下內容
magento1.9安裝完後登錄不了後臺,但是密碼和用戶名都是正確的,解決方法:
打開 magento/app/code/core/Mage/Core/Model/Session/Abstract/varien.php
找到下面的代碼,註釋掉$cookieParams['domain'] = $cookie->getDomain();這行,就行了。
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
}
結果如下
if (isset($cookieParams['domain'])) {
//$cookieParams['domain'] = $cookie->getDomain();
}
但是按照這個去做之後,還是出現錯誤,於是我把下面這段全部註釋掉
//if (isset($cookieParams['domain'])) {
//$cookieParams['domain'] = $cookie->getDomain();
// }
搞定,現在所有版本magento登陸不了後臺的問題都解決了,其實就是本地測試magento 1.9後臺登陸不了原因是權限問題,如果把localhost換成127.0.0.1就可以了。如果還登陸不了,歡迎發表回覆,都可以討論嘗試下看哪種方法可以。
- 本文固定鏈接: http://www.wangchuangs.com/technology/magento/430.html
- 轉載請註明: 王闖 2014年07月29日 於 創時代 發表