8

I installed locally magento 1.7.0.2 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

http://magento1/index.php/admin/index/index/key/56d082fb6349c1a302a5afd93ed14e9d/
9
  • did you check all browsers..some time magento will not open in chrome
    – VIVEK-MDU
    Commented Aug 6, 2013 at 13:02
  • 2
    read this stackoverflow.com/questions/15491819/…
    – VIVEK-MDU
    Commented 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 Commented Aug 6, 2013 at 13:13
  • No, it won't ...
    – webnoob
    Commented Aug 6, 2013 at 13:15
  • Did you try 127.0.0.1/index.php/admin ?
    – Shaz
    Commented Aug 6, 2013 at 13:17

7 Answers 7

8

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

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

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:

127.0.0.1 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.
4
  • Hi @webnoob..i think he already did it in core_config_data ..
    – VIVEK-MDU
    Commented 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
    Commented 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);
    – VIVEK-MDU
    Commented 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
    Commented Aug 6, 2013 at 16:40
1

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

6
  • please say downvote reasons? i just facing this error and i solved it...
    – VIVEK-MDU
    Commented 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. Commented 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..
    – VIVEK-MDU
    Commented Aug 7, 2013 at 4:39
  • read this also stackoverflow.com/questions/15491819/…
    – VIVEK-MDU
    Commented 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
    Commented Dec 13, 2013 at 23:42
1

in db: core_config_data

  • cookie_domain 127.0.0.1
  • cookie_path should be empty

change anything looking like your domain to

  • 127.0.0.1\localcopy\

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
1

I had this problem recently with Magento 1.9.2.1.

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.

1

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:

http://www.mymagentosite.com/index.php/admin/index/index/key/56d082fb6349c1a302a5afd93ed14e9d/

..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

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);
1
  • I would highly discourage editing Magento Core files. I would advise to change the configuration itself in order to get this to work.
    – 7ochem
    Commented 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.