I installed locally magento BUT i cannot login to admin panel!

WHAT TO DO?! I try absolutely everything solution in WEB!

I tried these suggested solutions

  • Clear the contents of the directory var/cache and try again. still NO ADMIN LOGIN

  • I fixed it by manually setting two core_config_data values in the database. They are as follows:

    web/cookie/cookie_path = /

    web/cookie/cookie_domain = "mydomain.com" still NO ADMIN LOGIN

  • I Opened Magento root directory and create tmp folder.
    and Open “lib/Zend/Cache/Backend/File.php“, and locate the following code:

    protected $_options = array( ‘cache_dir’ => null, replace with protected $_options = array( ‘cache_dir’ => ‘tmp’,

    still NO ADMIN LOGIN

  • I also checked my php.ini file there is upload_tmp_dir = "c:/wamp/tmp" still NO ADMIN LOGIN

Whats wrong with local instalations of Magento guys ???

I still get the same admin page with a a url like this

  • did you check all browsers..some time magento will not open in chrome
    Aug 6, 2013 at 13:02
  • 2
    read this stackoverflow.com/questions/15491819/…
    Aug 6, 2013 at 13:02
  • please remove session cache.. in var/session as well as var/cache and also browser cache.. might be it will work Aug 6, 2013 at 13:13
  • No, it won't ...
    – webnoob
    Aug 6, 2013 at 13:15
  • Did you try ?
    – Shaz
    Aug 6, 2013 at 13:17

7 Answers 7


This so far is the best solution rather than changing the code elsewhere:

Using phpMyAdmin, in your Magento database, look for the core_config_datatable and open 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

See also: http://iamtheshadowonthesun.blogspot.com/2012/10/magento-cannot-login-to-admin-panel.html

  • i think its better solution Mar 10, 2016 at 18:13
  • best solution, I just had this issue after ubuntu upgrade, now it works without touching the code
    – Deus777
    Apr 20, 2017 at 12:25
  • perfect answer for this question. This helps me out.
    – BornCoder
    Jun 6, 2017 at 5:49

I had an issue where magento wouldn't work without a valid domain name, with that in mind, I changed my hosts file in windows so the localhost entry read like: www.localhost.com

I then updated all the options in Magento's core_config_data table to point to my new domain name and it worked like a charm.

This saves having to comment out code locally.

As per the comments below:

  1. The reason this works is not that it's a domain name, it's because the Url then contains a (.). Using the IP directly would also work.
  2. Once you have updated the core_config_data table, it's advisable to truncate core_cache as well.
  • Hi @webnoob..i think he already did it in core_config_data ..
    Aug 6, 2013 at 13:28
  • Yes but if that Url doesn't work locally (because the host file is wrong) then setting it in core_config_data won't help.
    – webnoob
    Aug 6, 2013 at 13:29
  • I think so..He may be change in Abstract file...remove this line call_user_func_array('session_set_cookie_params', $cookieParams);
    Aug 6, 2013 at 13:32
  • ++ webnoob -- Might I add, whenever we change core_config_data, it's always best to TRUNCATE core_cache as well, since we can't access the admin panel to do it the "Magento" way ..
    – Zak
    Aug 6, 2013 at 16:40

try this

  1. Go to <localhost location>\app\code\core\Mage\Core\Model\Session\Abstract
  2. Open the file Varien.php
  3. Go to line no. 108

remove this line or comment this line

call_user_func_array('session_set_cookie_params', $cookieParams);

and then modified this code (line number 86)

$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath(),
//'domain' => $cookie->getConfigDomain(),
//'secure' => $cookie->isSecure(),
//'httponly' => $cookie->getHttponly()

thats all.. further more details READ THIS

  • please say downvote reasons? i just facing this error and i solved it...
    Aug 6, 2013 at 14:39
  • 1
    downvoted not by me but obviously because you dont need to hack the core with web findings if the problem can be solved truely / with knowledge. Aug 6, 2013 at 16:53
  • Thank you @MischaLeiss..obviously, I had face this kind of problem and solved by using above coding..many time i had solved it..
    Aug 7, 2013 at 4:39
  • read this also stackoverflow.com/questions/15491819/…
    Aug 12, 2013 at 18:00
  • 1
    While this should not be considered a permanent solution, it DID allow me to solve my problem of a mis-configured cookie domain.
    – Ryre
    Dec 13, 2013 at 23:42

in db: core_config_data

  • cookie_domain
  • cookie_path should be empty

change anything looking like your domain to


In app\etc\local.xml (check to have localhost)

In .htaccess disable the following if you had them enabled

<IfModule mod_rewrite.c>

# 301 direct to preferred domain
# RewriteEngine On
# RewriteBase /
# RewriteCond %{HTTP_HOST} !^your.domain.something$ [NC]
# RewriteRule ^(.*)$ http://your.domain.something/$1 [L,R=301]
# End 301 direct

I had this problem recently with Magento

I downloaded a copy to my local MAMP setup and could not login to the administration.

Always got the message that the formkey was invalid.

I tried everything mentioned in this and other threads:

Clearing folder /var/cache/ & /var/session/ Changing the urls in the database (table core_config_data) and checking if the cookie domain values were set.

No dice.

Then I found the solution:

  1. Check your logs in /var/logs for errors.

In my case the session was unable to initialize because it was set to use memcached, which I don't have on my local server.

  1. I updated my session handler in /app/etc/local.xml to use files instead of memcached

I hope this helps someone else.


I know this post is quite old, but yesterday I had the same problem: couldn't log in to admin and admin login page redirected to url with double index in the url like this:


..and having spent 4 hours trying to solve it, I share my solution here: I realized that I had access to my admin using my smartphone with 4G connexion. The problem was therefore the IP address that was filtered. The culprit: the MageFirewall extension in which I did not fill in the whitelist.


1) Go to app\code\core\Mage\Core\Model\Session\Abstract

2) Open the file Varien.php

Comment the below line

call_user_func_array('session_set_cookie_params', $cookieParams);
  • I would highly discourage editing Magento Core files. I would advise to change the configuration itself in order to get this to work.
    – 7ochem
    Nov 10, 2015 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.