How to fix login for admin on local install

Last modified by Brent W Peterson on Tue, October 19, 2010 10:01
Source|Old Revisions  

This is an old revision of the document!

Unable to login to Magento when installing on a local machine. Installation on Wamp, Mamp, Xampp etc. ??

If have just installed Magento on my local machine, but when you try to go to admin you can't login what can you do?

Problem as described: I enter my correct username and password but I am redirected to the same login page. I can an error message that says I entered the wrong username and password. When I enter my correct username and password I get redirected to the same login page.

The following are some help solutions:

  • Make sure you have cookies enabled in your browser, try a number of different browsers including Safari or Opera. Chrome will give some problems and you need to remember to clear you cache in Chrome after making changes!
  • Make sure you file permissions are set to EVERYONE - FULL CONTROL for Windows and 777 for your Mac/Linux environment If all that still doesn’t work you can try this: (I do not recommend this solution for a production version of Magento, but for you local test enviroment this will work.)

Magento 1.3 and below

Find app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. in your Magento install folder. Comment out the lines (see below) 80 to 83. The line number may vary.

(Sorry, the WIKI isn’t the best place to put code!)

You have to comment the comma (,) in line: $this→getCookie()→getPath(), set session cookie params session_set_cookie_params( $this→getCookie()→getLifetime(), $this→getCookie()→getPath() , $this→getCookie()→getDomain(), $this→getCookie()→isSecure(), $this→getCookie()→getHttponly() );

For Magento 1.4 and above:

Find app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. and look for line 86 to 98 if (!$cookieParams[’httponly’]) { unset($cookieParams[’httponly’]); if (!$cookieParams[’secure’]) { unset($cookieParams[’secure’]); if (!$cookieParams[’domain’]) { unset($cookieParams[’domain’]); } } } if (isset($cookieParams[’domain’])) { $cookieParams[’domain’] = $cookie→getDomain(); }