You want to install a new Magento instance (version 1.4.0.1 at the time of this writing) in your machine. You followed every steps from downloading up to the setting up of your admin account. Everything went fine so you assumed you’re good to go. You tried to login using your admin account… nothing happened. You tried again… Same login screen with no error whatsoever. You wonder what went wrong. You checked the files and the database as well as clearing the cache. You even tried resetting your account’s password found in the Magento’s admin_user table using the MD5 function thru phpMyAdmin but to no avail. You gave up and tried to reinstall everything only to be greeted by the very same login screen after clicking the Login button.

The real problem lies when a Magento instance is running through a localhost and tries to create a cookie, but fails to do so because it requires a domain and localhost is not a true domain (thanks to Mohammad Abdul Momin Arju for pointing this out in his blog). You can do a simple check to validate this by using Firefox and Firebug to check if a cookie is being generated by the Magento’s Admin Panel login page.

Magento's Admin Panel Login without cookie being generated upon loading
Magento's Admin Panel Login without a cookie being generated upon loading

At this point, we have to edit the core files without breaking the functionality behind this domain checking feature of Magento. To do this, open the following file:

Copy the Varien.php core file which can be found below:

app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

where we assumed that your root directory is htdocs and inside it is your magento folder.

Paste it in the Magento ‘local’ folder which can be found below (create needed folders if it doesn’t exists) and open the file for editing:

app\code\local\Mage\Core\Model\Session\Abstract\Varien.php

Go to line 96 or locate the code similar below:

if (isset($cookieParams['domain'])) {
    $cookieParams['domain'] = $cookie->getDomain();
}

Replace the code found in line 96 with this one:

if (isset($cookieParams['domain']) && !in_array("127.0.0.1", self::getValidatorData())) {

For Apple machines or other operating system, try what Nirav did found in his comment.

The purpose of this code change is to disable the Magento’s domain checking only if it is accessed via localhost and run as usual if it is being accessed thru a valid domain.

Clear your browser’s cookies to start with a clean slate then clear the Magento cache by deleting all the contents of the following folder:

var\cache

Access the Magento Admin Panel login again thru localhost while your firebug’s cookie tab being on (http://localhost:8080/magento/index.php/admin/). It should display something similar to the image below indicating that a cookie with an adminhtml name has been generated.

Magento's Admin Panel Login with a cookie being generated upon loading
Magento's Admin Panel Login showing a cookie 'adminhtml' generated after loading

At this point you should be able to login now with your admin username and password using localhost as your domain.

About the author

Richard Feraro is a Magento Enterprise Certified developer from Manila, Philippines with 14 years of solid open-source development experience using Linux, Apache, MySQL & PHP.

By Richard Feraro

Richard Feraro is a Magento Enterprise Certified developer from Manila, Philippines with 14 years of solid open-source development experience using Linux, Apache, MySQL & PHP.

352 thoughts on “How to Fix Magento’s Admin Login Failing (no error message) on Localhost”
  1. Thanks Richard…but I get another error for the admin page…doing all what u said, i get error “404 Not found” (!!!) for admin page (localhost/magento/admin or 127.1.1.1/magento/admin) which previously I had the admin page but now is all gone, i thought is the cache problem, even deleting the it didn’t fix the problem.

    Another thing that was fixed with the adjustments you said, was the front-end problem which I had, I wasn’t able to register a user, but now is OK!…yet the back-end suffers…

    1. Is your localhost IP correct (127.1.1.1)? It must be 127.0.0.1 and how about adding the index.php? try clearing your browser cache and var/cache too in your magento installation. It happened to me once but logging out then clearing the cache and var/cache did the trick.

  2. hi Richard, I have done evrything that what you said above, but i still can’t login to my magento admin panel. any suggestions ? my xampp version is 1.7.1 my OS is microsoft windows.

    thanks before
    boo

  3. Thank you so very much!

    Tried so many fixes, from modifying the /hosts file through to slashing out code, but this one is the most simple and it works!
    (Running MAMP, 10.5)

    Thanks again.

  4. Dude, you’re a star! Thank you sooo much! I went to bed on this problem, I get up and find your entry via Google and it works πŸ™‚

    Thank you very much πŸ™‚

  5. Hi sir ricahrd,

    I’m having a hard time login in to the admin panel, i’ve tried everything i could find.

    here’s my code:

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

    $cookieParams = array(
    ‘lifetime’ => $cookie->getLifetime(),
    ‘path’ => $cookie->getPath(),
    ‘domain’ => $cookie->getConfigDomain(),
    ‘httponly’ => $cookie->getHttponly()
    );

    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();
    }

  6. Hi Richard,

    I know this question of mine is irrelevant to this forum, but its kind of a similar cookie problem, not on the admin side of magento though, but on the frontend. When I login to the frontend I am redirected to the enable-cookies page, even though cookies are enabled on my browsers ( FF & IE ). This is intermittent. I mean this doesn’t happen every time i login. After that when I click on the home page link or any other page it works fine ( without having to do anything on the browser settings ).

    So if someone can help me, that would be great

    I use magento 1.3.2.4 & both ubuntu and windows machines as clients & windows (localhost ) & ubuntu (production ) as server

    Thanks
    Anisha

    1. Hello Anisha,

      If this happens only in localhost, meaning when you login both in Windows and your Ubuntu setup thru localhost you can do the same fix I had posted in this article. Then let me know if it works on your end. Clear your cache both in the Magento installation and in your browser.

      Thanks πŸ™‚

      1. Hi Richard,

        First of all thanks for your reply. You had asked me if this problem was only with localhost, No, this happens even on our staging server ( which has a .com domain).This is very intermittent, so difficult to say when exactly this occurs. But do you think cache could be a problem? I will definitely try that.

        And the fix you have recommended is it for the problem occurring on the staging server( which has a .com domain) as well ? Because the code above means that cookies need to be set only if its not a localhost.

        Please let me know.

        Regards

        1. As I’ve checked the other day, this seems to happen as well when people try to add items to cart using the same version of Magento. You can try one or all of the following:

          Option 1: Set your cookie to longer than the default (3600)
          Option 2: Are you familiar with Offline Maintenance extension? If you have it, Set the ‘Store Offline’ option to ‘no’
          Option 3: Someone also did the modification I posted in this article and it did work on his end.

          After doing any of the suggestion above, clear your cache. Delete all contents of ‘var/cache‘ and ‘var/session

    2. I found out that version 1.3.2.4 has a different Varien.php. Follow the instructions below:

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

      replace it with these code:

      if(!in_array("127.0.0.1", $this->getValidatorData())){
              // set session cookie params
              session_set_cookie_params(
                  $this->getCookie()->getLifetime(),
                  $this->getCookie()->getPath(),
                  $this->getCookie()->getDomain(),
                  $this->getCookie()->isSecure(),
                  $this->getCookie()->getHttponly()
              );
      }
  7. Ok richard, I will try these. The first option seems promising, because our servers are hosted in a different country than our local machine , and some other sites also suggest that change.

    and what does the Offline Maintenance extension do ? why is it used ?

    by the prior comment do u mean this change

    if(!in_array(“127.0.0.1”, $this->getValidatorData())){
    // set session cookie params
    session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath(),
    $this->getCookie()->getDomain(),
    $this->getCookie()->isSecure(),
    $this->getCookie()->getHttponly()
    );
    }

    and hey thanks so much for taking some time off to help me on this.

    Also one more thing, earlier in our old server box, we had set the php’s gc maxlifetime to a much higher value ( basically to work with payment gateways) , and when we were given a new box we have not yet set it… so u think this could be a problem?

    thanks
    anisha

    1. Hi Anisha,

      Yeah, extending the cookie expiration is the first thing to do when having issues with cookie session failing after sometime. Offline Maintenance extension allows you to display a ‘Maintenance Page’ if in case you need to set your store offline while doing backend configuration changes. And yes, that the code I’m referring to you. Do it also in your production since it will not interfere if it is not accessed via localhost. Regarding the php?s gc maxlifetime, always make sure that all of your servers have the same configuration to lessen the compatibility issues across multiple Magento setups.

  8. I am trying to setup magento on my local system using wamp

    I am getting this cookie issue :

    This problem can sometimes be caused by disabling or refusing to accept
    cookies.

    Can you please guide

    Regards
    Rakesh

    1. Hello Rakesh!

      If you’re version is the same as the version I used in this post, just follow the steps I made in this article πŸ™‚ It should fix that cookie issue like what it did to others here πŸ™‚

      Regards

    1. What’s your Magento and WordPress versions? Can you post your code here as to how you’re implementing it? If it doesn’t work, what’s the error if any?

  9. cookie problem, not on the admin side of magento but on the frontend. When I login to the frontend I am redirected to the enable-cookies page, even though cookies are enabled on my browsers ( FF & IE ).

    This happens everytime i login.Anyone getting this type of error or idea on how to deal with this?

  10. Thanks for the reply Richard

    I am using Magento 1.3.2.3..I am not able to login using front end in any case?i changed cookie to 10000 and tried everything but no luck until now???any help will be appreciated?

    I am trying to setup whatever i have in dev locally in my system.I changed all the required url`s in database and able to sucessfully log into admin..but not on frontend.what happens in front end is it says i am logged in and redirects me to the same page.

  11. I tried removing cache and deleting it from /var folder…but no luck still…hmm now i have no reason why its not letting me only in the frontend because i have tried almost everything to solve this πŸ™‚

    Mine url in database is setup like this abc.def.com:81 because i am running both apache and iis in the same machine…is that the problem?

    1. Oops don’t remove the cache folder. Just the contents of it. Did you do the same with the contents of the ‘sessions’ folder within ‘var’ folder? May I see your Magento ‘Web Configuration?’

  12. well if you are talking about magento web configuration than these are the things i have Url Option->Yes,use web server rewrites->yes,secure urls/unsecure urls are provided as needed…CMS No Cookie Page->Enable Cookies, Session Cookie Management .abc.com
    cookie path /
    cookie lifetime 86400
    use http only no
    value for all session validation setting and Browser capabilities setting is Yes.
    Is this useful to analyse what is the problem

    1. did you do the same with the ‘sessions’ folder? none of the values you’re sending are really helpful. i needed to see the ACTUAL values of the web configuration including the actual secure and unsecure urls.

      1. Actually i am having problem posting long config data i have to this blog because it is not allowing me to post it.

  13. Finally I made the change in the Web Configuration where it says “Use Secure URL in frontend” as No and it solved the problem.I was able to login to the frontend where user account info could be seen.

    I know its not good for staging and production but it works for local configuration for testing.

    Thank You Richard for your quick and awesome responses.I truly appreciate this effort πŸ™‚

  14. Hello I have taken your steps but have had no luck in logging into the admin on localhost. I use to be able to login in a few hours ago then it suddenly stopped for no apparent reason which led me here to your solution. xampp with magento 1.4.0.1. I have cleared cache and session folders and replaced copied Varien.php to the local/.. path you said but still cant login with localhost. if I replace with 127.0.0.1 it just takes me instantly to the frontend of site

    Any ideas how to fix this?

      1. Yes I am using firefox. I keep clearing cache but same problem. I have tried in IE also with no success

      2. I fixed it. Here is what I did. Using phpMyAdmin I opened core_config_data and changed the value of web/unsecure/base_url and web/secure/base_url from {{base_url}} with http://127.0.0.1/sitename/shop/ making sure to include the trailing / at the end

        Now I can login again!

  15. Hi, thanks and very glad for this forum. But can you help me? I can’t get through in the steps and I was in this process>>
    Go to line 96 or locate the code similar below:

    I do not know how to go there and locate the codes? I am not a techy person πŸ™

    I am using the FTP to copy the varein.php , is that correct?

    1. Hello evangeline,

      The best way to do it is download the file below to your computer and do the editing:

      app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

      the upload it to this location (create the folders if it doesn’t exists):

      app\code\local\Mage\Core\Model\Session\Abstract\Varien.php

      You need to have an editor with line numbers to see line 96. Or you can also do a Find command until you see the code:

      if (isset($cookieParams['domain'])) {
  16. Hi Richard.
    My problem seems to be more serious. Since I’ve been using magento, It doesn’t login to admin on Chrome and IE. I only use Firefox.

    Then I had the problem of non “www” redirect and my host asked me to change my Unsecure Base URL under System/configuration/Web to http://www.electroviva.com” Before, it was something like {{base_url}}
    Immediately I changed it and save… the admin quickly logged out and opened my home page.
    Since then, I’ve tried many times to log back in but to no avail. When I type “www.electroviva.com/admin” after putting my ID and password, it will redirect me to the frontend’s homepage.

    I’m stuck with this now and don’t know what to do.
    Pls could you help?

    Thanks

  17. Thanks for the help! I read a lot of solutions ( some non working too ), but your post is the most logical, and working one πŸ™‚

    Anyway I am not a computer genious, but your solution was quiet simple. The solutions with hacking the SQL database were like chinese to me ( I am from middle Europe ) πŸ™‚

    So thanks again!

  18. Richard Thank you so much, I solved this because u leave a msg at nickbartlett blog. I am a newbie for Magento, the source code just look like rocket science. hahaha

  19. I have done all of the above but in an earlier problem solver thought I would try and change my password. So clicked ‘forgotten password’ and sent it to my email where it has not arrived. So now when i try to login to magento admin I get invalid username or password!!!

    This is very frustrating. Could you please help.

    1. Check the following:

      1. After your unsuccessful login, what is the url in your browser? Can you post it here?
      2. Can you check if the ‘adminhtml’ cookie is present? To check it, you must have a Firebug and FireCookie plugin for Firefox.

  20. hi Richard..can you plz provide a unique link for magento installing..i am new to magento,i do know abt its installation..i had gone thru magento installation steps but i am unable to get it..so plz provide a link so that i can start running it..i already have xamp installed..plz do the needful..

  21. thanx a lot …You really saved my day…..And its my kind suggestion & request to write a full tutorial on Magento from novice to intermediate (atleast)…..Thank you once again….

    1. Thanks Jerome for the feedback πŸ™‚

      Regarding your suggestion, why not? Just keep on reading and who knows I might come up with something like that any time soon πŸ™‚

  22. hi, I’ve tried your method and it didn’t work for me. I tried installing the latest firebug (version 1.5.4) and there isn’t a cookies tab, is there any other way to check if the cookie has been generated? thank you in advance.

    1. How come you know that it doesn’t work when you haven’t installed everything you need to test it? You need to install Firecookie which is an addon for Firebug to show the cookie tab. It’s a 3rd party addon not provided by this blog so I didn’t include it. It was also mentioned in this same page at comment #281

  23. Hi sorry to trouble you again. I’ve now got firecookie installed and I’ve followed your step-by-step method. It seems like no cookies are being generated (no values appeared under cookies tab), I’m using Firefox 3.6.3 and I’ve enabled cookies in my browser (FF will remember history) and I still cannot login, both front and backend. Please help.

    1. When you try to login at the backend, what happens? What’s your URL before AND after you login? I need to see how your URL looks like.

      Also, what’s your Magento version?

  24. When I tried to login the page would reload with no error messages shown, I even tried resetting the password, still to no avail.

    I’m using Magento Version 1.4.1.1,
    URL before login is http://localhost/magento-1411/admin
    URL after login is http://localhost/magento-1411/index.php/admin/index/index/key/f4b2c7b9242d2ca242031025d6ebf2e3/

    I’ve tried clean the contents inside both var/cache and var/session folders, I live in the UK, I think Magento was set to US time zone when I tried installing it but since I cannot login I cannot be sure, do you think it could be the time zone problem?

    1. I don’t think the timezone setting will prevent you from logging in. Did you modify the Varien.php file line 96?
      app\code\local\Mage\Core\Model\Session\Abstract\Varien.php

  25. yes i did. Although I still cannot login, I now see a cookie being generated with below information:
    name: SESS6443484c53a47cc55ff3cc802947c025
    value: iidfpa715744ub25r5j29n0lr1
    domain: localhost
    path: /
    expires: Aug 25
    HttpOnly: no value
    Security: no value

    I’m running on XAMPP 1.7.3. (PHP 5.3.1). Please help.

    1. You have a weird cookie name. It should be named as adminhtml. I’m not sure if it is created by Magento or some other application in your localhost since they both share the same domain. I have two questions though:

      1. Did you try other methods in solving the problem from other blogs that slashes/comments out the code? If yes, restore the file to its original version during installation then repeat the change in line 96.
      2. Is your Magento installed in the root directory or a subdirectory within the root directory. Your cookie info (if it was really created by Magento itself) says it is installed in the root.
  26. Hi, I tried a fresh install of 2nd latest Magento (Ver 1.4.1) and your solution woks! For the newest version of Magento (Ver 1.4.1.1) I had to comment out $cookie->getConfigDomain() from $cookieParams array for it to work. It seems like magento can not set session and always create it again which prevents user from logging into the system.

    Thank you so much for your time and help!!!

  27. hey! finally you saved my hair. i’ve spent two days to find out. thank uuuuuuuuuuuuuuuuuuuuuuuuuuuuu very much

  28. Another frustrated Ihave done exactly as you wrote and still I am denied access to my website: I have done every single step you suggested but to no avail: Let me start It all began when I installed this because I want to shut off my site temporary which I succed , afterwards wanted to reactivate my site tried to log on again but to no avail, as told I have done everything that you and ?others? surgested but no success so far, if there is some good soul please guide me trough this hell, I will even supply with my password,

  29. hey thank that’s work ….
    but the code you replace should have close bracket …. otherwise it’s not work

    if (isset($cookieParams[‘domain’]) && !in_array(“127.0.0.1”, self::getValidatorData())) {

    }

    1. Thanks, but I think you didn’t understand the instruction. It says Replace the code found in line 96. The closing bracket is found at line 98.

              if (isset($cookieParams['domain']) && !in_array("127.0.0.1", self::getValidatorData())) {
                  $cookieParams['domain'] = $cookie->getDomain();
              }
  30. Thank you for responding me Richard, I am pretty convinced my version is 1.4.0.1, I am willing to give you ftp acess to my site so you can have closer look,

    1. Would you mind if you check it to make sure what version are you using? Just login to the admin panel and scroll down up to the footer area. It should display something in the middle like ‘Magento ver. 1.4.0.1’

  31. I have a severe suspeion that the problme is caused by ?Magento ArtsOnIt? which Iv installed I have tracked to on my site app/code/community/ ArtsOnIt!? but don?t have any clue how to get ride of it. Is it possible just to remove directly via FTP?

  32. Iam writing you again since i seems one of the most compentent out here, anyway i have managed to roll back to day before I installed that extension so things should be ok, but they aint.
    Again I flowed the steps you suggest again without any good results.

    Value : 6a95d54221dfd8bde0f5d9bf5f8d5357
    Path: /
    Name adminhotel
    Host: http://www.novatoys.dk
    (In any case im willing to hire for working solution)

    1. I think the cookie name should be adminhtml, not adminhotel unless you did some radical changes in the Magento core block Adminhtml. I also visited the host indicated in the cookie info (http://www.novatoys.dk) and was welcomed with the error below:

      Notice: Undefined index: httponly in /var/www/novatoys.dk/public_html/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 86

      This error occurs if you followed those blogs that tells you to slash or comment out all or parts of the code in Varien.php from line 77 to 84.

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

      I found out that because the httponly key from $cookieParams array is missing like what this error says: Undefined index: httponly

      I would suggest that you restore Varien.php file to its original form when it was installed and follow the instructions mentioned in this article; copy the file to Magento ‘local’ directory and edit ONLY line 96, no more, no less (ver. 1.4.0.1). I just want to be clear here, don’t modify the core files. There’s a reason why a local folder is present in magento\app\code directory and that is for you to copy the main core file that you need to edit in this location to make your installation upgrade-safe.

  33. Hey Richard,

    I’m using Bluehost(WAMP?) to host my website. Magento is 1.4.1.1.

    I have tried your suggestion. Copy the Varien.php to the local folder and only modify the line 96 — if (isset($cookieParams[‘domain’])) { , clean the cache and still have the error message.

    I have also tried to add ?//? to the ?domain?, ?secure? and ?httponly? and commented the line 86 to line 98, clean the cache and still didnt have any luck.

    Could you please help? Thank you so much in advance.

    1. Hey Richard,

      I installed Magento 1.4.1.0 on bluehost and also got this login error after flesh install. I have tried follow your instruction, copy the Varien.php core file to the local folder, modify the line 96, change the line 77, cleanout the var cache and session, but i still cannot log in.

      Could you please help? Thank you so very much in advance.

        1. Also, there shouldn’t be any error message since this article is about Fixing Magento’s Admin Login Failing (no error message), right? What is the error message you’re referring in the comment above?

  34. Hey Richard,

    Sorry for not been very clear. The error message i’m referring is the “invaild user name or password”.

    I also tried what you suggested for version 1.3.2.4 – line 77 :
    if(!in_array(“127.0.0.1”, $this->getValidatorData())){ // set session cookie params session_set_cookie_params( $this->getCookie()->getLifetime(), $this->getCookie()->getPath(), $this->getCookie()->getDomain(), $this->getCookie()->isSecure(), $this->getCookie()->getHttponly() ); }

    But i still cannot login. Anyway, here is my code from line 76 to line 99:

    // session cookie params
    $cookieParams = array(
    ‘lifetime’ => $cookie->getLifetime(),
    ‘path’ => $cookie->getPath(),
    // ‘domain’ => $cookie->getConfigDomain(),
    ‘secure’ => $cookie->isSecure(),
    ‘httponly’ => $cookie->getHttponly()
    );

    if (!$cookieParams[‘httponly’]) {
    unset($cookieParams[‘httponly’]);
    if (!$cookieParams[‘secure’]) {
    unset($cookieParams[‘secure’]);
    if (!$cookieParams[‘domain’]) {
    unset($cookieParams[‘domain’]);
    }
    }
    }

    if (isset($cookieParams[‘domain’]) && !in_array(“127.0.0.1”, self::getValidatorData())) {

    call_user_func_array(‘session_set_cookie_params’, $cookieParams);

    Thank you very much for your time and help !

    1. Does the error occur in your localhost or to a public site? If yes on localhost, proceed on the next line. If it’s happening on public site, either you forgot your username or password and it needs to be reset.

      If the error happens in your localhost, apply first the changes in line 96, no more no less. Then make sure your account details are correct. Reset if necessary. Your problem might not be related to the post here to be honest with you, so any change you do in the code will not resolve the “invaild user name or password”.

  35. It is on a public site. I’m using Blue Host Simple Script. I can either set my user name and password during the installation, or let system set a random password. Either way the system will show me the user name and password at the end of the installation.

    1. Since your site is in public, you shouldn’t change part of your code. The article I wrote affects only those who are using localhost. Your actual problem is found the error message “invaild user name or password”. You have to reset your admin account for Magento.

  36. I guess i will probably need to talk to Blue Host. Thank you very much for your help. Richard. I really appreciate it.

  37. I had the same problem. Running XAMPP on Mac OS X, with Magento 1.4.1.1.

    Your code fixed it, except I had to use “::1” instead of “127.0.0.1”. The trick was to do a “var_dump(self::getValidatorData());” just before line 96. “::1” is the IP address visible to a PHP script on a Mac when you run it through localhost (or in some other cases too). I replaced 127.0.0.1 with “::1” and it worked just fine.

    Thanks!

  38. Fatal error: Call to undefined method Mage_Core_Model_Cookie::grtDomain() in C:\wamp\www\magento\app\code\core\Mage\Core\Model\Session\Abstract\Varien.php on line 97 what could be the problemm

    1. Instead of posting your comments here in all caps which means you are shouting, how about you provide more details as to how you’re using it so that it will be easier to solve your problem?

  39. Tried many solutions unsuccessfully. Finally Richards solution works well on windows xampp, magento version 1.4.1.1
    Thanks a lot

  40. sorry about that Richard i did do it intentionally but please i need your help on this one cause i have so much to see images of the at the front end i cant i just see the blank space of default magento and the images of the products are already uploaded at the back end but at the front end they aint seen thanx but im realy sorry if i offended you

  41. ?<div class=”home_middle”>    <div class=”banner”>        <img src={{skin url=’images/summer_sale.png’}} alt=”" />     </div>    <div class=”clear”></div>    <div class=”styles”>        <div class=”all_styles”>            <div class=”style_img”>                <a href=”#”><img src={{skin url=’images/womenstyle.gif’}} width=”224? height=”223? /></a>              </div>            <div class=”style_lists”>                <div class=”style_head”>Featured in Women’s Style</div>                <div class=”list_in_styles”>                    <ul id=”liststyle”>                        <li><a href=”#”>Nicole Miller Dresses</a></li>                        <li><a href=”#”>Sunglasses</a></li>                        <li><a href=”#”>Totes</a></li>                        <li><a href=”#”>Shirts & Tops</a></li>                        <li><a href=”#”>Cocktail Dresses</a></li>                     </ul>                </div>            </div>        </div>        <div class=”all_styles”>            <div class=”style_img”>                <a href=”#”><img src={{skin url=’images/menstyle.gif’}} width=”224? height=”223? /></a>              </div>            <div class=”style_lists”>                <div class=”style_head”>Featured in Men’s Style</div>                <div class=”list_in_styles”>                    <ul id=”liststyle”>                        <li><a href=”#”>Ed Hardy Shirts</a></li>                        <li><a href=”#”>Adidas Men’s Shoes</a></li>                        <li><a href=”#”>Salvatore Ferragamo Shoes</a></li>                        <li><a href=”#”>Men’s Jeans</a></li>                        <li><a href=”#”>Men’s Sweaters</a></li>                     </ul>                </div>            </div>        </div>        <div class=”all_styles last_style”>            <div class=”style_img”>                <a href=”#”><img src={{skin url=’images/hairstyle.gif’}} width=”224? height=”223? /></a>              </div>            <div class=”style_lists”>                <div class=”style_head”>Featured in Beauty</div>                <div class=”list_in_styles”>                    <ul id=”liststyle”>                        <li><a href=”#”>Aveda Shampoo</a></li>                        <li><a href=”#”>Sephora Makeup</a></li>                        <li><a href=”#”>Perfume on Sale</a></li>                        <li><a href=”#”>Shaving</a></li>                        <li><a href=”#”>Scrubs and Exfoliants</a></li>                     </ul>                </div>            </div>        </div>                <div class=”clear”></div>     </div>     <div class=”clear”></div>     {{block type=”catalog/product_bestsellers” name=”home.catalog.product.bestsellers” alias=”product_bestsellers” template=”catalog/product/bestsellers.phtml”}}    {{block type=”catalog/product_new” name=”home.catalog.product.new” alias=”product_homepage” template=”catalog/product/new.phtml”}}    {{block type=”catalog/product_featured” name=”home.catalog.product.featured” alias=”product_featured” template=”catalog/product/featured.phtml”}}

    And this happens to be the back end of the display design of that front end so help me boss thanx again i know you will hel out

    1. There’s a LOT of invalid HTML attributes in the code such as missing quotes and questions marks here and there. Also, what’s that question mark doing at the beginning of your code? Make sure that you have all the template files you indicated here too:

      {{block type=”catalog/product_bestsellers” name=”home.catalog.product.bestsellers” alias=”product_bestsellers” template=”catalog/product/bestsellers.phtml”}}    {{block type=”catalog/product_new” name=”home.catalog.product.new” alias=”product_homepage” template=”catalog/product/new.phtml”}}    {{block type=”catalog/product_featured” name=”home.catalog.product.featured” alias=”product_featured” template=”catalog/product/featured.phtml”}}
  42. hi richard,

    I have done evrything that what you said above, but i still can’t login to my magento admin panel. any suggestions ? my xampp version is 1.7.1 my OS is microsoft windows and magento version 1.4.1.1 . plz help me

    thanks
    rajesh

  43. i changed to xampp-win32-1.6.6a-installer and now im geting this error of Unable to open WampServer’s config file, please change path in index.php file, im using magento 1.4.1.1 how can i over come that, thanx Richard

    1. You’re error isn’t related to Magento but rather to XAMPP or WAMP installation. Refer to their site for support. Also, I wonder why do you need two types (XAMPP and WAMP) of Web/HTTP server application in the same machine when both of them does the same thing which will likely produce conflicts from port use to configurations?

  44. hi Richard !
    i did what you said but now i got :

    Parse error: parse error in D:\Program Files\wamp\www\htdocs\magento\app\code\core\Mage\Core\Model\Session\Abstract\Varien.php on line 129

    ok, i’am a noob in magento issue but can’t understand what is the probleme.
    i got lastest version of magento and runing on localhost with wamp

    thx !

    1. You’re having an error at the portion where the post didn’t instruct you to change anything. You’re only instructed to change LINE 96, no more no less. Your Varien.php might have been modified by you using other methods provided by other blogs. Restore it to its original copy upon installation and do the modification in LINE 96 only.

  45. Another thing i forgot is how can one upload magento files using xampp-win32-1.6.6a-installer failed to that thanks again

  46. Hi Richard,

    I have tried your solution, but I can’t get it to work… yet. What I get is: “HTTP 500 Internal Server Error”.

    I’m running Magento 1.4.1.1 on Apache 2.2.11 (Win32) + PHP 5.2.8 with mcrypt and pdo_mysql enabled.

    I have tried several browsers, all with cache/cookies cleared and always with an empty magento/var/cache folder.

    The original Varien.php file is still in the folder \app\code\core\Mage\Core\Model\Session\Abstract\

    The modified Varien.php file is in the new folder \app\code\local\Mage\Core\Model\Session\Abstract\

    In the modified Varien.php file, I have changed the local host IP address from 127.0.0.1 to the actual IP address of my localhost, but without results. I’ve tried various addresses with and without :8080 added to it, just to try if that would do the trick. Unfortunatly, nothing worked.

    Do you perhaps have any idea what I am doing wrong?

    1. Your error isn’t related to Magento but instead to your web server setup. There’s a misconfiguration in either your .ini or with your .htaccess file. When an error occurs within Magento, it usually displays its default error page with the actual error or just an error number depending on your admin configuration.

  47. Richard,

    I am using magento ver. 1.4.1.1 just made a clean install of the latest version. I change anything in my config and I get this error, and I can not login to admin.

    I tried your steps and I get no results in the firecookie plugin, and I am worried I can not get my site back.

    My site: http://testing.freakingadorable.com/

    Bryan

    1. You shouldn’t get any error with the instruction I provided in the post. If you did follow the steps provided, restore your Varien.php from this location:

      app\code\local\Mage\Core\Model\Session\Abstract\Varien.php

      and overwrite it with the file coming from this location:

      app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

      then change line 96 only. It should work since there are commenters here such as Andi, Mayank and more who successfullly did it using Magento version 1.4.1.1 too.

  48. so I did another clean install, with a new php.ini and htaccess. Put your code in and I am back up and running. Thank you again!

  49. Thanks a lot,
    This way to fix this problem seems better to me than the “adding a point in the URL” solution

  50. If you read this far and still have the issue make sure the field

    System -> Configuration -> General -> Web -> Session Cookie Management -> Cookie Domain is not set to any other domain than your own (it should be 127.0.0.1 for instance).

    This ended up being our problem after sharing our dev database.

    1. If you have access to your database, go to table core_config_data and find web/secure/base_url in the path column. What’s string in the value column?

    1. Let’s check if the SSL certificate is the culprit. In core_config_data table, locate the web/secure/use_in_adminhtml in the path column and set the value column to 0, go to http://chatwindirect.com/admin (take note that you’re not using https anymore) and try logging in again.

      Please take note that whenever you’re making any changes to the files and/or database, always clear the contents of the directories var/session and var/cache.

  51. hi guys,

    please help me with this hadeacke, i have installed magento on localhost and i cant log in to admin, i get the error invalid username and password, i have tried the 127.00 something like this, i overwrited de varien but stil it does not work i have done al the steps you mention in your earlier post but it doest not work, i have the the newest version of magento and wampserver 2.

    i am looking forward to your answer

    1. Hi Reza, the details in this post would only work if your Magento is running in a local machine and if there’s no error that appears during login. In your case, the error is because of invalid credentials so you just have to reset it via database.

  52. same issue my friend! i appreciate your help!
    we also installed magento in another folder:
    chatwindirect.com/m
    we did an import of the database and we were able to login into the admin panel of chatwindirect.com/m and view the all products(in the backend NOT the frontstore), but once we did a re-index of data same issue occurred!

    do you have any more suggestions? thanks..

  53. Dear Friend,

    I have installed magento 1.4.2.0 and i can’t login to admin panel, i get the error invalid username and password. i changed al die line in varien.php but it did not worked, can you help me.

    thankx

  54. Hi Richard,

    to tell you the truth i am a beginner and working with magento. I dont know how to change that in magento database. I start php myadmin and then i click on my magento database i made and then i go to admin and when i want to log in i get this error. i have installed magento on my computer on localhost. i changed the points you wrote in varien.php. but still it doest not work

  55. I made the change and get the following error:

    Parse error: syntax error, unexpected T_PUBLIC in C:\wamp\www\magento\app\code\local\Mage\Core\Model\Session\Abstract\Varien.php on line 132

    This is what my code looks like:

    if (!$cookieParams[‘httponly’]) {
    unset($cookieParams[‘httponly’]);
    if (!$cookieParams[‘secure’]) {
    unset($cookieParams[‘secure’]);
    if (!$cookieParams[‘domain’]) {
    unset($cookieParams[‘domain’]);
    }
    }
    }

    if (isset($cookieParams[‘domain’]) && !in_array(“127.0.0.1”, self::getValidatorData())) {

    call_user_func_array(‘session_set_cookie_params’, $cookieParams);

    if (!empty($sessionName)) {
    $this->setSessionName($sessionName);
    }

  56. Hi,
    I ve installed magento on server. I am able to see the frontend without any problem. In the admin panel, when I click on ‘Add product’ button, I get the following error. All other things work fine in admin panel

    There has been an error processing your request

    Wrong tab configuration.

    Trace:
    #0 /clientdata/n5200-2-dynamic/t/e/teeshop.com.au/www/shoppingcart/magento/app/code/core/Mage/Core/Model/Layout.php(347): Mage_Adminhtml_Block_Widget_Tabs->addTab(‘googleoptimizer’, ‘tab_googleoptim…’)
    #1 /clientdata/n5200-2-dynamic/t/e/teeshop.com.au/www/shoppingcart/magento/app/code/core/Mage/Core/Model/Layout.php(213): …

    1. Hello Anitha,

      Your error isn’t related to the post or even to Mage Enabler. It’s about Google Optimizer configuration. You might have upgraded your setup which override some of the files. Try reinstalling the magento-core/Mage_Core_Modules in Magento Connect.

      Thank you.

  57. Richard,
    Google Optimizer is already set to No in System->Configuration->Google API. It is not enabled. I am not using google web optimizer tool. Thank U anyways.

  58. Hi Richard,

    I have a live site that is having the enable cookies error. I have tried everything I have found online and after each change, made sure to delete the files in the var/cache and var/sessions folder.

    The only thing I found that works is to comment out lines 81, 82, 83 of the varien.php file like so…

    // HIDE TO FIX ENABLE COOKIES ERROR ‘domain’ => $cookie->getConfigDomain(),
    // HIDE TO FIX ENABLE COOKIES ERROR ‘secure’ => $cookie->isSecure(),
    // HIDE TO FIX ENABLE COOKIES ERROR ‘httponly’ => $cookie->getHttponly()

    Now that I have done so, will this have any negative results later?

    Details: Magento Ver. 1.4.1.1
    Host: BlueHost

    Thanks for your time.

    1. Hello Peaker,

      You can configure Magento not to check those variables in the admin panel instead of commenting out the code.
      System > Configuration > General > Web -> Session Cookie management
      System > Configuration > General > Web -> Session Validation Settings

      Regarding the Enable cookie message, try disabling it in:
      System > Configuration > General > Web -> Browser Capabilities Detection > Redirect to CMS-page if cookies are disabled > No

  59. My admin panel will not let me login. i changed the admin passwords, logged out and it will not let me back in with my new or old password. I requested a password and it sends me a new password but does not work when I enter it in the login form. Is this related to your thread here or is there another issue I’m dealing with. The error I get is that this username/ password is invalid.

    Thanks for your help.

    1. Hello Kinney,

      It’s different from the post. It really means your credentials are incorrect.

      Regards

  60. Big up to Richard and Nirav for this solution, I am using MAMP and OSX as a dev environment and this problem was driving me nuts! Good work

  61. Thank goodness, after following through this whole blog, doing everything that you suggested, I thought I couldn’t solve my problem, but your link to Resetting the Admin Account was what helped in the end.

    Finally I managed to log in to Magento for the first time ever. Thank you very much, Richard, hope you continue to work on this and give us more support in the future, cause it’s tough to find good and really competent people, especially online.

    Again, thank you very much for opening this solution blog.

    With Sincere Regards,

    Artur Balestro

  62. hello

    just want to share how this guideline help me

    yes this thing work on me

    i work this way i apply first that changes

    then clear my cookies

    and i dont delete those cache file any more

    and the finalle i make a fresh install magento

    and guest what its working now

    thanks for this πŸ™‚

  63. Richard – First of all, thank you for your continued support of this post, it’s much appreciated. I have installed Magento 1.5.1.0 on a live dedicated server that is currently accessible only by its IP address.

    I have duplicated the Varien.php file over to /app/code/local/Mage/Core/Model/Session/Abstract/Varien.php and copied your code in place of line 96 (and only line 96), but I still am not able to log in to the admin. I have been careful to delete var/cache and var/session files each time as well as purging my browser cache and cookies.

    Any suggestions?

    1. How about the URL? Can you post the URL found in the address bar when the page is blank?

    1. Have you tried disabling the Add Secret key to urls in System->Configuration->Admin panel->Security?

  64. Richard – I certainly appreciate your volunteer efforts here, but if you don’t see a simple solution I’d be willing to contract with you as a freelancer to fix this for us. Email me if you’re interested.

  65. This is a new installation and I have yet to successfully access the admin. So, no, I am not able to try disabling the “Add Secret Key” configuration.

  66. I have tried the solutions here with no luck.

    I had originally installed magento on my rented server space at http://www.digitalintrospect.net/labels/magento

    I decided to get rid of the magento folder, and test everything by moving it to http://www.digitalintrospect.net/labels2

    after I moved all of the files, i logged on to my admin site and update the secure and unsecure url.

    After I did this, everytime I try to go to http://www.digitalintrospect.net/labels2/index.php/admin
    I get redirected to the index homepage without being able to access the backend.

    I am desperate for help!

    1. I think your problem is different from my post because the post is for those Magento setup who’s admin login redirects to a blank page with a weird URL. Yours might be an error in configuration both in base url and secure url.

  67. Hi there Richard.

    I have this problem but is it when using my ipad 2 to log in. It does not work for admin…But I can log in fine using my PC.

    Do you think it may be solved by anything mentioned above?

    Cheers.

    1. Hi Mike,

      If you can login thru PC/Mac, the solution I posted might not help you. Have you tried clearing the cache of your tablet’s browser?

  68. Hello Richard, I am having the same issue in a different way. I am able to log into Magento admin just fine. When I try to log in magento connect and I fill in the admin and password nothing happens. The logs show nothing as well. So I flushed my index ad cache and cleared my cookies for my browser, still no luck. Are you familiar with issue or have any advice on what I should do to fix it. Everything seems to work fine except logging into Magento Connect.

    GoDaddy Virtual Dedicated Server – The site is up on my server and not local.

  69. Hi Richard,

    your article gave me the right hint to solve my login problem. I did some changes in the admins system konfiguration where I edited the cookie settings. Everything worked perfect on that friday. But this monday I could not log in any more πŸ™
    Because I added many mod rewrites on that black friday, I was searching in my apache config for the error without any result.

    So here is what can help too, when login is impossible and no cookie is set.

    Search all entries with the path ‘web/cookie/cookie_domain’ in the table ‘core_config_data’ and check the value for a valid domain. If you are not shure about the right value simply empty the field ore use the following query:

    UPDATE `core_config_data` SET `value` = '' WHERE `path` = 'web/cookie/cookie_domain';

    I don’t know if the entry exists in 1.4 but in 1.5 it can be set and changed.

    Christian

  70. Hi..

    I am working on data processing, on Megento from my country, and I need your help, Megento is working fine on one machine, but its is not getting open in google chrome on another machine, I have installed win xp fresh, I dont understand what is needed to get access in to it kog in, I get the admin page but it is not opening the magento, and there is no error or masage.

    Please help, I have to get it to work on the second system and I need it to work on my network as well..

    please reply soon..

    Amay

  71. Hi Richard
    I installed Magento through xamp on the server successfully. I loged in admin panel it gives me 404 error when i am in admin panel.I cleared cache also, My main concern is I cant create Products in magento in admin panel.I cant export products and cant make csv file also,I need your help πŸ™‚

  72. Hi Richard,

    I am upgrade the magento 1.3 to 1.5. after that can’t logged in admin and no error message displayed.

    I am clear the cache also. need yr help. Thanks in advance

  73. I have a new method.

    xampp\magento\app\code\local\Mage\Core\Model\store.php

    Go to line 690 or locate the code similar below:

    public function isCurrentlySecure()
    {
    $standardRule = !empty($_SERVER[‘HTTPS’]) && (‘off’ != $_SERVER[‘HTTPS’]);

    ….

    Replace the code found from line 690 to line 722 with this one:

    public function isCurrentlySecure()
    {
    return false;
    }

    MY magento version is 1.6.1
    Xampp is 1.7.7
    OS win7, IE9

    1. This is wrong and could break the basic functionality of Magento when it requires to be in HTTPS especially during communication with payment gateways.

      Check my latest post. It might be related.

  74. I have installed magento successfully. Then I have put my live site database dump to local database. When I try to login with valid user name and password, again login page only loading. I have tried the procedure which you have mentioned in forum like changing Varien.php, cleared cache and cookies, but still exists same issue. Kindly guide me, how to rectify this issue.

    1. Have you applied the changes I mentioned in the post? Did you try applying other fixes apart from what I posted? If yes, please restore your code to the original and re-apply only my code.

  75. I have had zero luck with anything I have found…I am using version 1.4.1.1 and the code from this site does not work for me at all. Please help, I have changed line 96 to no avail. What’s odd is that I can log in to my admin page using other computers, and even an iPhone. However my laptop will not work. No error, just a reload of the admin login screen. Again, only happens on my laptop, not any other device. I Have tried using IE, Chrome, and Safari on the laptop and still nothing. Any idea’s??

  76. I am also not running via localhost but am experiencing the problem on version 1.6.1. All was well for several weeks as I worked on the site. Today I made the fatal error of enabling cache on the site. Now the only way I can login is if I go into my browser and delete cookies for the site. This problem only affects the backend. I have disabled cache, cleared every cache imaginable, cleared the var/cache folder. The problem persists. I don’t think my client will be happy with clearing cookies each time he wants to login. What a nightmare. Any ideas?

  77. Problem solved. Make sure you don’t have the unsecure and secure URLs set to your domain with the www in front of the domain name in the web configuration section in the admin.

  78. Hi. Just install Magento theme and facing the same problem couldn’t login.

    if (isset($cookieParams[‘domain’]) && !in_array(“127.0.0.1”, self::getValidatorData())) {

    Can i ask this ip is it same for everyone? 127.0.0.1?

  79. Hello there, seems as if this conversation and help is the most active and has the most results, so I hope you will be able to help me out too! πŸ™‚

    I had the same error as you described in your fix explanation.
    I installed magento locally on my mac through Mamp, all went well, I installed a template and imported a sql dump of the template sample data and all was well.
    The reason I had this installation locally is because I needed to copy some of the codes of the sample data dump to my working online installation of magento. So I was busy opening some stattic block and some cms pages to copy their code and paste it in my other installation, but suddenly I hit the return/back (sorry working with the dutch version) button on the stattic block page and got the error!
    So I came here and did what you explained, also filling in the ::1 instead of the other ip code because I’m on a mac, cleaned caches and now I get the following on both the front and back end:

    Zend_Db_Statement_Exception Object
    (
    [_previous:Zend_Exception:private] =>
    [message:protected] => SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_order_aggregated_updated’ already exists
    [string:Exception:private] =>
    => 42
    [file:protected] => /Applications/MAMP/htdocs/magento/lib/Zend/Db/Statement/Pdo.php
    [line:protected] => 234
    [trace:Exception:private] => Array
    (
    [0] => Array
    (
    [file] => /Applications/MAMP/htdocs/magento/lib/Varien/Db/Statement/Pdo/Mysql.php
    [line] => 110
    [function] => _execute
    [class] => Zend_Db_Statement_Pdo
    [type] => ->
    [args] => Array
    (
    [0] => Array
    (
    )

    and so and so on, a whole page….

    I didn’t however do the following explained by Nirav:

    β€œvar_dump(self::getValidatorData());”

    because I didn’t understand.. :/

    Also; I’m using magento 1.6.1 if that makes a difference.
    The code you speak of is also on a slight different line;

    this is on line 92 to 110:

    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();
    }

    call_user_func_array(‘session_set_cookie_params’, $cookieParams);

    if (!empty($sessionName)) {
    $this->setSessionName($sessionName);
    }

    thanks for your help hopefully ::)))

    1. Hello Diana, thanks for dropping by.

      Based on what you posted, the cause of the error is that a part of the script you have tries to create the table/view ‘sales_order_aggregated_updated’ when it is already present in the database. Do you have a file with a similar name in the location below:

      app/code/core/Mage/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php

      Did you do any upgrade? If yes, just rename the file above into anything you want and try again.

      Cheers πŸ™‚

  80. hi richard,

    this is kind of off-topic, but I would like to consult you on the proper way to move my magento installation from a subdirectory (ourwebsite.com/beta) to root (ourwebsite.com).

    I’ve read several posts from various magento forum and they mostly have different ways of achieving the task. Honestly, I’m a little confused on which one to follow.

    I have been an avid visitor of your website and I have full confidence that you’d be able to assist me on my magento conundrum. πŸ™‚

    So, help me please? πŸ™‚

    thank you in advance

    Chris.

  81. Hi Richard
    Thanks you online help is wonderful, I am using magento 1.6.1.0 and having problem to log in to back end, returned to same log in page time and again, I tried to fix as per your suggestion, but then get syntax error in line 134
    Here is my original code:
    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();
    }

  82. Richard Feraro

    Is 100% on-point with his Topic Fix:

    if(!in_array("127.0.0.1", $this->getValidatorData())){
    // set session cookie params
    session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath(),
    $this->getCookie()->getDomain(),
    $this->getCookie()->isSecure(),
    $this->getCookie()->getHttponly()
    );
    }

    This will allow you to create-set cookie session for the localhost only.
    Without it, you may be sharing your localhost port with other Website that you are developing on your local server.

    XAMPP, WAMP or LAMP.

  83. I’ve been fighting the “Access Denied” message for 5 hours now. I can’t even get into mysite.com/admin. As a result of trying a lot of things I’ve seen here and the Magento forums, I’ve totally screwed up my site. (User error – not the result of your advice!)

    I’m not technical at all. So now I don’t know what to do. Is it possible to hire you for a few minutes (which is probably all it would take YOU) to look at it? I’m wondering if I would be better off to just download the latest version. (I think I’m on 1.3.-something).

    Thanks in advance!

  84. we are having a strange problem till we migrated the domain. now we can login via only one admin user, we can create new admin user, surprisingly can not login using new userid/password. any idea?

  85. I have a similar problem. I have a new magento site running magento CE 1.6.0 that is installed on a virtual server with a domain (i.e. not installed on my local machine). I used to be able to log in via the admin login page. Now I am unable to. I don’t know what happened to cause the problem but the symptoms are the same as the ones you describe in your post. If I log in with my correct username/password i am immediately redirected back to the login page with no error message. If i log in with an incorrect username password I get an error message saying my username or password is invalid. I have tried many of the solutions suggested on this blog post and others, including commenting out various lines in my /app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file, making sure that my web/cookie/cookie_domain entry in the database is set to my site domain, setting web/secure/use_in_adminhtml to 0, clearing the var/cache folder and var/session folders more times than I can count, etc.

    It seems to me that my problem is cookies related. It doesn’t look like my site is setting any cookies. When I inspect at the login page on firefox with firebug and firecookie, it looks like there are no cookies being set at all on my site. Since all of the solutions here have something to do with cookies I figure that that’s a good bet, but I have no idea how to troubleshoot that.

    I hope you can help me. I’m banging my head against a wall here. Thanks in advance.

    1. Restore first your copy to the original one without all the modification you did to fix this. After that, try to create a script that generates a cookie and see if it does. If you are able to generate a cookie using your script, then its a config issue with your magento.

  86. Thank you for your response. I reset my settings to the way it was before I started to troubleshoot. (I had already reset my Varien.php file when the modifications did not work) I created a custom script and successfully set a cookie on the site. It wasn’t a particularly useful one (the value is set to “foo”) but at least I know that my site can set cookies. Magento is just not setting them for some reason.

  87. Hi
    I have installed Magento to the site and I too have the same issue. I am unable to log in to the admin panel. Magento version is 1.7
    Furthermore I installed Magento to the Public HTML root as well as in to a different folder. I have tried more than 10 times fresh installations. But same issue. Could you please advise me.
    Thanks,
    Ed

  88. Hello Richard,

    Thanks for this blog.

    It however don’t think it will work for me as my problem is the other way round -it is the online Admin that I cannot login to.

    The whole picture:

    1) phpmyadmin database export from live site & import into new database for localhost

    2) Logins to both localhost and live Admin both working fine.

    3) made changes on localhost (deleted pages, and editted pages, etc) then exported localhost database, added the additional code to the SQL file from Magento site, then imported the database into live site. (again using phpmyadmin)

    Now cannot login to live site admin but can still login to localhost admin without a problem.

    I sometimes get the login page and input credentials then get 404 Not found error, or I just get the 404 Not found error.

    Have tried your fix including commenting out the ” ‘domain’ => $cookie->getConfigDomain(), ” as mentioned for version 1.4.1.1
    but no luck – still cannot login to live admin panel.

    Any idea how to fix this??

  89. Thank you very much for sharing yor solution..I followed kathys hint..putting www. infront of base url…crazy..now some internal links wont work :)..thank you… ie can login finaly after 3days of..’#?!

  90. i’m getting error like this after editing the code

    Parse error: syntax error, unexpected T_PUBLIC in C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Session\Abstract\Varien.php on line 139

  91. I can’t access my client’s magento backend panel πŸ™ When I try to use the username and password he gave me, the page just refereshes and nothing happens. What could possibly be the reason for this?

  92. thanks .
    after 12 hour for solving this problem i found this article and magento is working now. amazing website.

  93. I am using Magento 1.7.0.2 and xampp 1.7.7

    Admin works fine on local but cant open on live server. Already done what you have said.

    Any suggestion?

  94. Thanks Richard, that worked for me too. I hope Magento implement your solution.

    I think it would be a good idea to fully detail Nirav’s workaround for MAMP in your post, as I got a little confused and initially included ‘var_dump(self::getValidatorData());’ before the code change.

    Kind regards, Martin

  95. Hey Richard,

    Firstly, The posts are really very much useful. Thanks for the same.

    I was also facing the same problem as I would not be able to log in into admin panel for magento 1.3.2.4 version.

    I’ve also tried the above solutions but still didn’t want to change the code. So found one more solution.

    This problem can also be resolved by setting the value of web/cookie/cookie_domain = “” in your “core_config_data” table.

  96. Hi Richard, Thanks for giving idea to how solve the problem from facing the Magento Admin Login Failing (no error message) on Localhost. This really helpful to me when i am facing this problem. Thank you so much for giving this beautiful solution.

  97. will it work in websites that have a domain? i cant log in the dashboard even we have reset the password and username. we need help.

    thanks and Godbless!

  98. Hi richard,

    I have done everything that what you said above, but i still can’t login to magento admin panel. my magento version 1.7.0.0.
    I comment that code, clear cache & session, also increase the limit of cookies, in firebug there is display “Adminhtml” in cookies tab.

    Plz help me. waiting for your reply.

    Thanks
    Nayan

  99. Hello Richard,

    what about Magento ver. 1.7.0.2 community edition?

    I’ve done as suggested in your post but no luck yet :(.

    I’m running it on google chrome on windows 7 with xampp 1.8.1 .(though it is working fine in firefox!)

  100. Hello Richard,
    what about Magento ver. 1.7.0.2 community edition?
    I’ve done as suggested in your post but no luck yet .
    It works fine in firefox bt not in chrome…y?I have tried wtever u said.

  101. Hi Richard,

    I am not able to access admin .

    This is the error that I get while logging into the admin..

    SELECT `e`.*, SUM((e.base_subtotal-IFNULL(e.base_subtotal_refunded,0)-IFNULL(e.base_subtotal_canceled,0)-IFNULL(e.base_discount_amount,0)+IFNULL(e.base_discount_refunded,0))*e.base_to_global_rate) AS `revenue`, SUM((e.base_tax_amount-IFNULL(e.base_tax_refunded,0)-IFNULL(e.base_tax_canceled,0))*e.base_to_global_rate) AS `tax`, SUM((e.base_shipping_amount-IFNULL(e.base_shipping_refunded,0)-IFNULL(e.base_shipping_canceled,0))*e.base_to_global_rate) AS `shipping`, COUNT(e.entity_id) AS `quantity` FROM `sales_order` AS `e` WHERE (e.entity_type_id = ’11’) AND (e.state != ‘canceled’) GROUP BY `e`.`entity_type_id`

    any idea how to fix this?

    Regards,
    Ammu

  102. Also double check your app/etc/local.xml file and make sure your session data isn’t being saved to something like memcache. This has come up for me when moving sites from production down into a development environment. And if the session data is being saved to file, make sure you have permissions in var/ to create the session directory.

  103. Hi,

    I’m getting nuts. I transferred a Magento installation to a local server.

    I access that local server via a VPN connection with the URL
    http://192.168.1.100/magentotest/magento/

    No matter what I configure (and I did a lot of trial and error) – I’m unable to login to the admin backend or with any customer account.

    Any hints for me?

    Thanks a lot in advance and regards,

    Josch

  104. Hi Richard,

    yes, I did. I set both to “http://192.168.1.100/magentotest/magento/” – nothing happens.

    The “frontend” cookie isn’t set, no matter, what I try. None of the above solutions worked (changes in “app\code\core\Mage\Core\Model\Session\Abstract\Varien.php” etc.).

    My Magento version is 1.7.0.2

    Any help is appreciated. I’m runnig agains a wall with this …

    Josch

  105. Hi Richard,

    this is stupid. The customer had set the php.ini parameter “session.use_cookies” to 0 – that was so extraordinary that I hadn’t thought about that posibility – now it runs as expected %-/

    Thanks a lot for your support and excuse this weird problem! πŸ˜‰

    Josch

  106. Hi Richard,

    I am getting the problem of login on frontend on apple devices.
    I am using magento 1.7.0.2 extension, I had tried all the options but still not able to login on front end.
    Right now my site is running on my company’s server.
    Please help it’s really very urgent

    Thanks
    SS

  107. Hey Richard,

    I have applied the above mentioned solutions, but still not able to login to magento frontend. still getting invalid login error

  108. I uploaded magento at my hosting, meanwhile i forgt username and password..
    So i deleted old magento and installed a new one..
    it is still showing me wrong username or password.
    What shall i do now.
    Some one told me that it takes 2-3 hours to update.
    i also tried one more thing. i copied password from mysql from admin_user table

    and decrypt it using md5 decryption
    it is showing me the same password which i am entering while when i enter it on admin page it says wrong username and password

  109. I just downloaded the current stable version (1.8.1.0). Since creation of this Article, over 4 years have passed.
    How is this Bug not fixed yet?

  110. I have found the same method here.
    http://stackoverflow.com/questions/13860936/magento-cant-login-in-admin-with-right-username-and-password
    Provided by the user Chetan
    I did that in his way and it solve the problem yesterday
    however when I try to login the admin the problem happen again
    My internet connection is very good, I can easily open the home page and inner page.
    it take about 1 minute to login to the admin, meanwhile it is very hard to add the product to the shopping bag, until this problem fixed.
    That is very curious.
    Do you have any suggestion

  111. Hi Richard, hi guys!

    I’m in a pretty stupid situation and I can’t get out of it. Using Magento 1.7, I initially had some issues with the add-to-chart funcion on chrome browser working badly.

    I’ve started to try some solution playing with the Cookie Lifecycle time from de admin panel and the varien.php file.

    The problem is, at some point I’ve replaced the cookie lifecycle time value from the admin (3600 to 1), and after that, every time I’m logging into the admin, after just a click I’m automatically disconnected.

    I can’t go back to the default 3600 or any other value cause it doesn’t let me the opportunity to save my change (it disconnects and go back to the login page);

    Is there a chance you could help me to find a way to access the admin and having enough time to change the cookie lifetime value I’ve set to 1 ?

    Thank you for your help, I’m quite disasperate now.

    Guillaume

    1. Hi Guillaume,

      Connect to your database and find the table named ‘core_config_data’ and search for the record with ‘path’ = ‘web/cookie/cookie_lifetime’. Change the value to 3600.

  112. in 2016 and i have kind of the same problem.
    I have a magento site. I used to be able to log in via the admin login page. Now I am unable to. I don’t know what happened to cause the problem but the symptoms are the same as the ones you describe in your post. If I log in with my correct username/password i am immediately redirected back to the login page with no error message. If i log in with an incorrect username password I get an error message saying my username or password is invalid. I have tried many of the solutions suggested on this blog post and others, including commenting out various lines in my /app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file, making sure that my web/cookie/cookie_domain entry in the database is set to my site domain, setting web/secure/use_in_adminhtml to 0, clearing the var/cache folder and var/session folders more times than I can count, etc.

    I hope you can help me. Thanks in advance.

Leave a Reply