装了Magento发现不能登陆后台

来源:互联网 发布:创迹网络 编辑:程序博客网 时间:2024/04/27 16:14

 装了Magento 后用不能登陆后台,没有提示用户名和密码错误的情况。

 发生问题是因为无法存储cookies。我们运行localhost和本地主机是不正确的域名,但我们需要一个域去存储cookie。所以不能登陆

解决方法: 打开 app/code/core/Mage/Core/Model/Session/Abstract/varien.php

将// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);

改为:

// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

 

其他方法:

1)直接用 http://127.0.0.1  登陆

2) 可以修改 hosts 文件 C:/WINDOWS/system32/drivers/etc 并将127.0.0.1 指向 magento.localhost