Why I can not login to magento backend using google chrome
I am using magento community edition 188.8.131.52.I am not able to login to back end of magento.I know this problem can be because of chrome not accepting cookies. But how to fix that please help. Thanks
One simple solution is to do the installation using Opera browser and use it to log in because it saves the cookies itself. It works!
If you enabled the https for the Magento admin panel, then make sure to set "NO" for the option "Use HTTP Only" under System->configuration->web->Session and Cookie Management."
If you have access to the database then open the table "core_config_data" and search for the Path "web/cookie/cookie_httponly" and set the value to "0".
Make sure to delete the var/cache folder. Now try to login to Magento admin panel. Mostly you can now. If not post your issue in this thread.
So this "Not able to login Magento admin panel" issue mostly relates to the Magento cookies settings. So don't get worried if you encounter this tiny issue. With the list of answers in this thread you can easily sort this out in a few minutes time.
There are two solutions for this, either one will work:
- Change the cookie lifetime configuration.Go to backend -> Sytem -> Configuration -> Web -> Session and Cookie Management Set cookie lifetime to 86400 and save it .
- Go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.
Find the code:
session_set_cookie_params( $this->getCookie()->getLifetime(), $this->getCookie()->getPath(), $this->getCookie()->getDomain(), $this->getCookie()->isSecure(), $this->getCookie()->getHttponly() );
// session cookie params $cookieParams = array( 'lifetime' => $cookie->getLifetime(), 'path' => $cookie->getPath(), 'domain' => $cookie->getConfigDomain(), 'secure' => $cookie->isSecure(), 'httponly' => $cookie->getHttponly() );
and replace with
session_set_cookie_params( $this->getCookie()->getLifetime(), $this->getCookie()->getPath() //$this->getCookie()->getDomain(), //$this->getCookie()->isSecure(), //$this->getCookie()->getHttponly() );
// session cookie params $cookieParams = array( 'lifetime' => $cookie->getLifetime(), 'path' => $cookie->getPath() // 'domain' => $cookie->getConfigDomain(), // 'secure' => $cookie->isSecure(), // 'httponly' => $cookie->getHttponly() );
After this save the file.
This so far is the best solution rather than changing the code elsewhere http://iamtheshadowonthesun.blogspot.com/2012/10/magento-cannot-login-to-admin-panel.html
Using phpMyAdmin, in your magento database, look for the core_config_data table and click it. Click the "Search" tab. Then on the "path" column set the operator to LIKE %...% and the Value to cookie and click the "Go" button to search.
After searching, set the value of web/cookie/cookie_path, web/cookie/cookie_domain, web/cookie/cookie_httponly, and web/browser_capabilities/cookies to NULL
the problem is that chrome isnt storing the login cookie, this can be seen by looking at the cookies in chrome | settings | content | advanced | all cookies and site data
there's probably a number of reasons why this can happen, cookie lifetime for sure is one of them..
personally I encountered this problem when running magento in localhost / on a virtual machine and connecting from a browser on the same machine. specifically the problem seems to be that chrome will not store cookies if the domain name is not qualified. so if your domain name is 'http://localhost/magento' or 'http://somename/magento' chrome will not store the cookie and consequently you will not be able to login
here's the fix:
to keep this simple i'm sticking to the example where magento is running on localhost. the same trick will work if magento is running on a vm and you're accessing from localhost, but you need to modify the hosts file on both guest os and client in such a case. (and remember that the guest ip can change so from time to time you need to update the hosts file on the host)
first choose your domainname. it's only in local so you dont need to register. i'm choosing 'dansmagentodev.com'. then in magento | system | web modify baseurl in both secure and unsecure to be http://dansmagentodev.com/magento/
next, in the same place, modify the session cookie management 'cookie domain' to be 'dansmagentodev.com'
next we need to configure your system to know that dansmagentodev.com is really localhost. we do this via the hosts file. on windows this file is in C:\Windows\System32\drivers\etc\hosts. your virus checker will probably try to stop you modifying it (for good reason, disable virus checker while you make the modification). then add the line 127.0.0.1 dansmagentodev.com
And now log in from chrome.
what worked for me is what Haijerome, unfortunatelly I can't login into the backend to change the config. This is what I execute whenever I install a new fresh magento:
insert into core_config_data(scope, scope_id, path, value) values("default", "0", "web/cookie/cookie_httponly", "0");
rm -Rf var/cache/mage--*
Our Chrome users were unable to add items to their cart... changing the Cookie Lifetime to the recommended 86400 fixed it.
Magento Community 1.7
My problem was the fact that the server I was running was an Ubuntu fresh install with very little server maintenance configuration.
It had not updated it's date & time and it was 3h behind.
This made cookies received by Chrome to look as if they were already expired so Chrome discarded them.