How to Fix Magento’s Admin Login Failing (no error message) on Localhost

In: Feeling guru|Techie Daw

24 Mar 2010

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 web programmer from Manila, Philippines with 13 years of solid open-source development experience using Linux, Apache, MySQL & PHP.

341 Responses to How to Fix Magento’s Admin Login Failing (no error message) on Localhost

Avatar

Lawrence Salmingo PHILIPPINES

March 25th, 2010 at 6:27 pm

Wow! It Works. Thanks!

Avatar

Richard Feraro PHILIPPINES

March 26th, 2010 at 7:45 am

You’re welcome Lawrence :)

Avatar

seeal SPAIN

March 27th, 2010 at 9:45 pm

works on :D thx!!

Avatar

Richard Feraro

March 28th, 2010 at 10:48 am

thanks too for the feedback :)

Avatar

Idk2good BRAZIL

April 8th, 2010 at 6:02 am

Yep, it worked! thanks

Avatar

Richard Feraro UNITED STATES

April 8th, 2010 at 10:00 pm

@Idk2good: You’re welcome :)

Avatar

Albert NETHERLANDS

April 11th, 2010 at 5:11 am

Great!. It works!! :-D

Avatar

Richard Feraro PHILIPPINES

April 11th, 2010 at 5:38 am

Thank you Albert :)

Avatar

salman ISLAMIC REPUBLIC OF IRAN

April 11th, 2010 at 3:00 pm

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…

Avatar

Richard Feraro PHILIPPINES

April 11th, 2010 at 6:08 pm

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.

Avatar

shedemei SPAIN

April 12th, 2010 at 5:57 am

It works!!! Finally!! *_* Thank you VERY MUCH!!!!

Avatar

Richard Feraro

April 12th, 2010 at 12:05 pm

You’re welcome :p

Avatar

boo INDONESIA

April 13th, 2010 at 12:10 pm

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

Avatar

boo INDONESIA

April 13th, 2010 at 12:13 pm

and by the way, there is no cookies tab on my firebug adds on.. any help ?

Avatar

Richard Feraro UNITED STATES

April 13th, 2010 at 3:05 pm

What’s your Magento version?

Avatar

Richard Feraro UNITED STATES

April 13th, 2010 at 3:06 pm

It’s an additional extension for Firebug.
https://addons.mozilla.org/en-US/firefox/addon/6683

Avatar

Kent NEW ZEALAND

April 14th, 2010 at 8:47 am

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.

Avatar

Richard Feraro PHILIPPINES

April 14th, 2010 at 10:07 am

Thank you for the feedback Kent! :)

Avatar

Mark Haller UNITED KINGDOM

April 15th, 2010 at 2:43 pm

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 :-)

Avatar

Richard Feraro UNITED STATES

April 15th, 2010 at 3:35 pm

Hi Mark! Thanks for the feedback. Glad to help you :)

Avatar

Paolo Sarangya PHILIPPINES

April 17th, 2010 at 11:03 am

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

Avatar

Richard Feraro PHILIPPINES

April 18th, 2010 at 4:49 pm

Restore your code to it’s original version then follow my instructions in the post above.

Avatar

Anisha INDIA

April 20th, 2010 at 8:39 pm

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

Avatar

Richard Feraro UNITED STATES

April 20th, 2010 at 9:20 pm

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 :)

Avatar

Richard Feraro UNITED STATES

April 20th, 2010 at 10:11 pm

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

Avatar

anil INDIA

April 21st, 2010 at 2:07 am

Thanks Richard

For providing a more secure way to log into Admin Panel on a local machine

Avatar

Richard Feraro PHILIPPINES

April 21st, 2010 at 2:25 am

Thank you too Anil for the feedback :)

Avatar

Anisha INDIA

April 21st, 2010 at 1:13 pm

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

Avatar

Richard Feraro UNITED STATES

April 21st, 2010 at 4:07 pm

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

Avatar

Anisha INDIA

April 21st, 2010 at 4:17 pm

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

Avatar

Richard Feraro UNITED STATES

April 21st, 2010 at 5:25 pm

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.

Avatar

Andreas GERMANY

May 5th, 2010 at 4:29 am

After searching quite a little time, i found this!
GREAT !!!

Thanks

Andreas

Avatar

Richard Feraro PHILIPPINES

May 5th, 2010 at 9:51 am

Thanks for the feedback Andreas! :)

Avatar

Rakesh Ranjan INDIA

May 5th, 2010 at 11:39 am

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

Avatar

Richard Feraro UNITED STATES

May 5th, 2010 at 2:33 pm

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

Avatar

Rakesh Ranjan INDIA

May 5th, 2010 at 11:37 pm

Nope no luck..Still having same problem

Avatar

Richard Feraro PHILIPPINES

May 6th, 2010 at 2:36 am

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?

Avatar

phpkid UNITED STATES

May 7th, 2010 at 1:47 am

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?

Avatar

Richard Feraro

May 7th, 2010 at 10:21 am

What’s your Magento version and how many instance of Magento do you have in your hosting?

Avatar

phpkid UNITED STATES

May 9th, 2010 at 12:58 am

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.

Avatar

Richard Feraro

May 9th, 2010 at 1:53 am

Delete all the contents of ‘sessions’ and ‘cache’ folders found within ‘/var’ folder, then try it again.

Avatar

phpkid UNITED STATES

May 9th, 2010 at 6:16 am

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?

Avatar

Richard Feraro

May 9th, 2010 at 11:15 am

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?’

Avatar

phpkid UNITED STATES

May 9th, 2010 at 12:28 pm

No i didnt delete the folder…just the content of it.

Avatar

phpkid UNITED STATES

May 9th, 2010 at 12:30 pm

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

Avatar

Richard Feraro

May 9th, 2010 at 2:11 pm

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.

Avatar

Richard Feraro

May 9th, 2010 at 2:12 pm

if you’re having doubts of showing the values, just upgrade your Magento to the latest version.

Avatar

phpkid UNITED STATES

May 9th, 2010 at 8:34 pm

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

Avatar

phpkid UNITED STATES

May 9th, 2010 at 9:19 pm

I did the same for session folder

Avatar

phpkid UNITED STATES

May 10th, 2010 at 3:13 am

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 :)

Avatar

Richard Feraro UNITED STATES

May 10th, 2010 at 10:30 pm

If changing that setting fixed your problem in logging in the frontend, maybe you don’t have a valid SSL certificate configured in your server.

Avatar

Josh UNITED STATES

May 15th, 2010 at 4:04 pm

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?

Avatar

Richard Feraro PHILIPPINES

May 16th, 2010 at 2:35 am

Are you using firefox? It happened to one of the readers here as well. Try clearing the browser cache. Try it also in other browsers.

Avatar

Josh UNITED STATES

May 16th, 2010 at 3:17 am

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

Avatar

evangeline UNITED STATES

May 16th, 2010 at 4:19 am

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?

Avatar

Josh UNITED STATES

May 16th, 2010 at 4:48 am

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!

Avatar

Richard Feraro PHILIPPINES

May 16th, 2010 at 10:08 am

So it’s a configuration issue. I’m glad that you were able to fix it :)

Avatar

Richard Feraro PHILIPPINES

May 16th, 2010 at 10:20 am

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'])) {

Avatar

John CHINA

May 22nd, 2010 at 12:36 am

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

Avatar

Ol? Mundo! » Erro de login no admin do Magento no localhost (sem mensagem de erro) UNITED STATES

May 22nd, 2010 at 11:18 am

[...] Pesquisando um pouco no google percebi que o problema estava na verifica??o de cookies e a ?nica solu??o que encontrei foi, infelizmente, alterar uma linha na biblioteca, seguindo as instru??es desse post: http://mysillypointofview.wordpress.com/2010/03/24/how-to-fix-magentos-admin-login-failing-no-error-…. [...]

Avatar

Richard Feraro

May 23rd, 2010 at 11:42 am

try adding a ‘/’ at the end of your Unsecure Base URL so it would look like http://www.electroviva.com/

Avatar

Bozz HUNGARY

May 25th, 2010 at 4:07 pm

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!

Avatar

Richard Feraro UNITED STATES

May 25th, 2010 at 5:09 pm

Thank you Bozz for the feedback! I’m glad that the post did help you.

Avatar

Shiro MALAYSIA

May 28th, 2010 at 3:19 pm

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

Avatar

Richard Feraro UNITED STATES

May 28th, 2010 at 4:33 pm

Hello Shiro! Thanks for the feedback :) Keep on reading!

Avatar

Clara SINGAPORE

May 28th, 2010 at 11:40 pm

you’re awesome. THANKS!

Avatar

Richard Feraro UNITED STATES

May 28th, 2010 at 11:57 pm

Thanks Clara! Keep on reading :)

Avatar

Chris UNITED KINGDOM

June 6th, 2010 at 7:40 pm

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.

Avatar

Richard Feraro

June 7th, 2010 at 11:25 am

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.

Avatar

praneeth INDIA

June 15th, 2010 at 2:30 pm

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

Avatar

Richard Feraro UNITED STATES

June 15th, 2010 at 3:33 pm

Hello praneeth,

The only installation I use is the one found in the Magento Knowledge Base. You can try this wiki too if you are still having problems installing it.

Avatar

Ami Sidhpura INDIA

July 15th, 2010 at 9:55 pm

Hi Richard, I searched a lot after i found you article thanks you very much for the solution with better reason to change the file.

Avatar

Richard Feraro UNITED STATES

July 15th, 2010 at 10:30 pm

Thanks Ami for the feedback. Keep on reading! :)

Avatar

jerome UNITED STATES

July 26th, 2010 at 9:50 pm

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

Avatar

Richard Feraro UNITED STATES

July 26th, 2010 at 10:27 pm

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 :)

Avatar

cfemocha

July 31st, 2010 at 5:33 am

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.

Avatar

Richard Feraro

July 31st, 2010 at 11:35 am

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

Avatar

cfemocha

August 1st, 2010 at 7:42 pm

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.

Avatar

Richard Feraro

August 1st, 2010 at 9:38 pm

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?

Avatar

cfemocha

August 1st, 2010 at 9:55 pm

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?

Avatar

Richard Feraro UNITED STATES

August 2nd, 2010 at 7:18 pm

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

Avatar

cfemocha

August 2nd, 2010 at 8:19 pm

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.

Avatar

Richard Feraro UNITED STATES

August 2nd, 2010 at 9:17 pm

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.

Avatar

cfemocha

August 2nd, 2010 at 11:00 pm

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

Avatar

satheesh INDIA

August 9th, 2010 at 7:23 pm

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

Avatar

Richard Feraro UNITED STATES

August 9th, 2010 at 8:26 pm

Thanks for the feedback Satheesh! I’m glad that you still have your hair :p

Avatar

Tedros FRANCE

August 10th, 2010 at 7:28 am

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,

Avatar

Richard Feraro UNITED STATES

August 10th, 2010 at 4:08 pm

What’s your Magento version Tedros?

Avatar

vortana

August 10th, 2010 at 9:00 pm

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())) {

}

Avatar

Richard Feraro UNITED STATES

August 10th, 2010 at 9:10 pm

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

Avatar

Tedros FRANCE

August 11th, 2010 at 2:06 am

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,

Avatar

Tedros FRANCE

August 11th, 2010 at 7:36 am

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?

Avatar

Richard Feraro UNITED STATES

August 11th, 2010 at 9:38 pm

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′

Avatar

Richard Feraro UNITED STATES

August 11th, 2010 at 9:40 pm

Magento has its own way of properly uninstalling an extension. Please refer to the extension developer of Magento ArtsOnIt for further details.

Avatar

Tedros FRANCE

August 12th, 2010 at 7:16 am

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)

Avatar

Archie PHILIPPINES

August 12th, 2010 at 4:37 pm

Wow man! Thanks so much. I nver thought with the new version of Magento, this problem still exist.

Thanks again.

Avatar

Richard Feraro UNITED STATES

August 12th, 2010 at 11:31 pm

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.

Avatar

Richard Feraro UNITED STATES

August 12th, 2010 at 11:33 pm

Thanks for the feedback Archie :) Keep on reading!

Avatar

Mayank INDIA

August 21st, 2010 at 3:39 pm

Hi Richard thanks for your posts.Finally implemented Magento CE ver 1.4.1.1

Avatar

Richard Feraro PHILIPPINES

August 22nd, 2010 at 2:26 am

Thanks Mayank. I’m glad that the post did help you :) Keep on reading!

Avatar

Wal CHINA

August 24th, 2010 at 1:35 am

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.

Avatar

Wal CHINA

August 24th, 2010 at 12:08 pm

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.

Avatar

Richard Feraro UNITED STATES

August 24th, 2010 at 7:34 pm

For Magento version 1.4.1.1 Try doing what cfemocha did here.

Avatar

Richard Feraro UNITED STATES

August 24th, 2010 at 7:35 pm

What did you change at line 77? I only mentioned to update line 96 in this article.

Avatar

Wal CHINA

August 25th, 2010 at 4:22 pm

Yes, I changed the line 77 as well, but still got the error message.

Avatar

Richard Feraro UNITED STATES

August 25th, 2010 at 5:32 pm

No, what I meant was, what did you change in line 77? The only thing found in line 77 is the code below:

// session cookie params

Avatar

Richard Feraro UNITED STATES

August 25th, 2010 at 5:34 pm

May I see your code from line 76 to line 99 of Varien.php?

Avatar

Richard Feraro UNITED STATES

August 25th, 2010 at 5:36 pm

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?

Avatar

paixao

August 26th, 2010 at 1:08 am

Funcionou!..

Avatar

Richard Feraro PHILIPPINES

August 26th, 2010 at 1:52 am

Thanks for the feedback :)

Avatar

Wal CHINA

August 26th, 2010 at 4:00 pm

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 !

Avatar

Richard Feraro UNITED STATES

August 26th, 2010 at 4:16 pm

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

Avatar

Wal CHINA

August 26th, 2010 at 5:02 pm

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.

Avatar

Richard Feraro UNITED STATES

August 26th, 2010 at 5:13 pm

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.

Avatar

Wal CHINA

August 26th, 2010 at 6:32 pm

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

Avatar

Nirav Mehta INDIA

September 10th, 2010 at 4:32 am

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!

Avatar

Richard Feraro PHILIPPINES

September 10th, 2010 at 12:12 pm

That’s great Nirav! Thanks for the feedback for Magento users running it in Apple machine.

Avatar

sonko

September 21st, 2010 at 3:28 pm

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

Avatar

Richard Feraro UNITED STATES

September 21st, 2010 at 4:21 pm

getDomain() instead of grtDomain()

Avatar

sonko

September 21st, 2010 at 8:13 pm

now hw comes my when i try to images at the backend i fail to see in the front end

Avatar

sonko

September 21st, 2010 at 8:15 pm

thanc Rich it worked

Avatar

sonko

September 21st, 2010 at 10:19 pm

ITS GIVING ME HARD TIME TRY TO LOAD IMAGES FROM THE BACK END

Avatar

Richard Feraro UNITED STATES

September 21st, 2010 at 11:22 pm

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?

Avatar

Andi GERMANY

September 26th, 2010 at 12:12 am

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

Avatar

Richard Feraro PHILIPPINES

September 26th, 2010 at 2:45 am

Thank you Andi for the feedback.
Keep on reading :)

Avatar

sonko

October 8th, 2010 at 9:19 pm

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

Avatar

sonko

October 8th, 2010 at 10:16 pm

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

Avatar

Richard Feraro PHILIPPINES

October 9th, 2010 at 1:42 pm

I think your Magento problem isn’t related to this post. Please stick to the topic instead to keep the comments related and so that others won’t get confused.

Avatar

Richard Feraro PHILIPPINES

October 9th, 2010 at 1:44 pm

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”}}

Avatar

rajesh AUSTRALIA

October 13th, 2010 at 10:32 pm

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

Avatar

Moncho MEXICO

October 14th, 2010 at 4:54 am

Man wich line you comment out , cant make it work on version 1.4.1.1

Avatar

Richard Feraro UNITED STATES

October 14th, 2010 at 5:44 pm

It’s just the same as version 1.4.0.1. Read the instruction found in this article.

Avatar

Richard Feraro UNITED STATES

October 14th, 2010 at 5:46 pm

I upgraded my copy to version 1.4.1.1 and I was able to login after I did the change in Varien.php as instructed above. What exactly is your error?

Avatar

Sandhya INDIA

October 19th, 2010 at 1:06 pm

Thanks for this post. It resolves my problem in localhost

Avatar

Richard Feraro UNITED STATES

October 19th, 2010 at 3:47 pm

Thanks for the feedback Sandhya :)

Avatar

sonko Arnold

October 21st, 2010 at 5:56 pm

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

Avatar

guital FRANCE

October 21st, 2010 at 6:01 pm

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 !

Avatar

sonko Arnold

October 21st, 2010 at 6:11 pm

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

Avatar

Richard Feraro UNITED STATES

October 21st, 2010 at 6:16 pm

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.

Avatar

Richard Feraro UNITED STATES

October 21st, 2010 at 6:21 pm

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?

Avatar

Richard Feraro UNITED STATES

October 21st, 2010 at 6:24 pm

If it is a local machine, you just have to copy the Magento files in either htdocs or www directory, whichever is available in your setup.

Avatar

wanna be starting something NETHERLANDS

October 22nd, 2010 at 5:29 pm

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?

Avatar

Richard Feraro UNITED STATES

October 22nd, 2010 at 5:59 pm

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.

Avatar

Hafiz AbdulRehman PAKISTAN

October 23rd, 2010 at 2:25 am

Thanks boss

Avatar

Richard Feraro PHILIPPINES

October 23rd, 2010 at 2:02 pm

Thank you too :)

Avatar

Bryan UNITED STATES

October 27th, 2010 at 4:07 am

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

Avatar

Richard Feraro PHILIPPINES

October 27th, 2010 at 1:21 pm

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.

Avatar

Bryan UNITED STATES

October 27th, 2010 at 11:47 pm

Could it be because of my php.ini or htaccess file that this error is occurring?

Avatar

Bryan UNITED STATES

October 28th, 2010 at 4:31 am

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!

Avatar

Richard Feraro UNITED STATES

October 28th, 2010 at 6:09 pm

Glad you’re site is fixed. Thank you too.

Avatar

hjian CHINA

November 14th, 2010 at 12:51 pm

so good,IMPORTANT FOR ME!THANK YOU!

Avatar

James Wales PHILIPPINES

November 23rd, 2010 at 3:23 pm

You helped me a lot dude…! i was googling for days searching for bug fixes. Thank YOU!

Avatar

Richard Feraro UNITED STATES

November 23rd, 2010 at 3:24 pm

That’s good to hear James :)
Thanks for the feedback!

Avatar

Richard Feraro UNITED STATES

November 23rd, 2010 at 3:25 pm

Thanks for the feedback :) Keep on reading!

Avatar

Charles Menard FRANCE

December 1st, 2010 at 11:54 pm

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

Avatar

Richard Feraro UNITED STATES

December 2nd, 2010 at 11:15 pm

Thanks for the feedback Charles :)
Keep on reading!

Avatar

karthikeyan INDIA

December 6th, 2010 at 3:50 pm

HI sir Richard,

Am applied ur code in magento 1.3.2.4…Now admin panel work nice…
Thanks a lot….

Avatar

Richard Feraro PHILIPPINES

December 6th, 2010 at 4:38 pm

That’s good to hear :-)
Thanks for the feedback.

Avatar

Tiago Alves PORTUGAL

December 15th, 2010 at 8:57 pm

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.

Avatar

Richard Feraro UNITED STATES

December 15th, 2010 at 9:05 pm

Thank you Tiago for the info :)

Avatar

Filipe BRAZIL

December 17th, 2010 at 3:32 am

Hi Richard, thanks for the post, but I have a big problem, you can
http://isosom.com.br view is functioning normal, but after
access login and password in the admin panel, it returns http error
404, can you help me identify the solution?

In summary my site works, but not my admin panel :(

http://isosom.com.br/index.php/admin

Avatar

Richard Feraro PHILIPPINES

December 17th, 2010 at 11:29 am

Does it happen also in invalid login or only during successful logins?

Avatar

Mark UNITED STATES

December 18th, 2010 at 4:47 am

That worked for me! I was worried I was going to have to purchased MAMP Pro there for a second!

Avatar

Richard Feraro PHILIPPINES

December 18th, 2010 at 9:26 am

Thanks for the feedback Mark :-)

Avatar

Jb FRANCE

December 20th, 2010 at 11:53 pm

Thanks !! This solved my problem.

Avatar

Richard Feraro

December 20th, 2010 at 11:57 pm

Glad to hear that :-)

Avatar

Tariq UNITED KINGDOM

December 22nd, 2010 at 8:52 am

your the man thanks!!!

Avatar

Richard Feraro

December 22nd, 2010 at 3:38 pm

Thank you :-)

Avatar

cocotu UNITED STATES

December 23rd, 2010 at 12:03 am

i’m getting the same issues as your post, but on a live store: http://chatwindirect.com/admin
where starting yesterday we canNOT login to the admin panel and we get no error messages, it just refreshes the page and nothing happens.
can someone help? thanks.

Avatar

Richard Feraro UNITED STATES

December 23rd, 2010 at 12:18 am

What’s the URL in the address bar after you have clicked the Login button?

Avatar

cocotu UNITED STATES

December 23rd, 2010 at 12:34 am

Avatar

cocotu UNITED STATES

December 23rd, 2010 at 12:39 am

Avatar

Richard Feraro UNITED STATES

December 23rd, 2010 at 12:52 am

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?

Avatar

cocotu UNITED STATES

December 23rd, 2010 at 1:05 am

Avatar

Richard Feraro UNITED STATES

December 23rd, 2010 at 1:27 am

There must be a trailing slash “/” at the end of it.
https://chatwindirect.com/

Avatar

cocotu UNITED STATES

December 23rd, 2010 at 1:35 am

sorry richard, but there is a trailing slash i missed that! sorry.
https://chatwindirect.com/

Avatar

Richard Feraro UNITED STATES

December 23rd, 2010 at 4:01 pm

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.

Avatar

reza NETHERLANDS

December 25th, 2010 at 6:52 am

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

Avatar

cocotu UNITED STATES

December 26th, 2010 at 11:14 am

Sorry for the late response(Xmas). I am trying your suggestion right now.

Avatar

cocotu UNITED STATES

December 26th, 2010 at 11:43 am

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

Avatar

reza samadi NETHERLANDS

December 27th, 2010 at 4:42 am

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

Avatar

Richard Feraro PHILIPPINES

December 27th, 2010 at 7:07 am

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.

Avatar

cocotu UNITED STATES

December 27th, 2010 at 11:48 am

richard, we decided to re-install. all works for now. thanks for your help.

Avatar

reza samadi NETHERLANDS

January 1st, 2011 at 2:22 am

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

Avatar

Mark SPAIN

January 15th, 2011 at 11:31 pm

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

Avatar

Mark SPAIN

January 15th, 2011 at 11:33 pm

Sorry…forgot to mention that it’s:

Magento 1.4.2.0
Apache 2.2.17
PHP 5.2.11

Avatar

Mark SPAIN

January 16th, 2011 at 12:13 am

found my issue…I misread and replaced lines 96-98. Duh

Avatar

Richard Feraro PHILIPPINES

January 16th, 2011 at 3:49 am

Hehe I was about to say that in my reply to you :-)

Avatar

Alex UNITED KINGDOM

February 9th, 2011 at 9:48 pm

Nice one man!

This is is annoying every time but it’s a nice clean fix!!

Peace

Avatar

Richard Feraro UNITED STATES

February 9th, 2011 at 9:51 pm

Thank you Alex :)

Avatar

Anitha INDIA

February 16th, 2011 at 7:39 pm

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): …

Avatar

Richard Feraro UNITED STATES

February 16th, 2011 at 7:50 pm

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.

Avatar

Anitha INDIA

February 16th, 2011 at 8:03 pm

I am using Magento 1.4.1.1 and my admin URL is http://www.teeshop.com/index.php/admin. I am unable to add products in the admin panel. This is a fresh installation of Magento. I get the above mentioned error when I try to add products in admin panel. Can you pls help

Thank you

Avatar

Anitha INDIA

February 16th, 2011 at 8:06 pm

Avatar

Anitha INDIA

February 16th, 2011 at 8:19 pm

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.

Avatar

Richard Feraro UNITED STATES

February 16th, 2011 at 9:12 pm

I edited my previous reply. See if that will help you.

Avatar

Peaker UNITED STATES

March 3rd, 2011 at 8:21 am

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.

Avatar

Richard Feraro

March 3rd, 2011 at 11:47 am

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

Avatar

Peaker

March 6th, 2011 at 8:15 am

Thanks Richard! I reverted my code and made the change through the admin.

Avatar

Richard Feraro UNITED STATES

March 7th, 2011 at 4:18 pm

Cool!

Avatar

Billy PHILIPPINES

March 11th, 2011 at 2:17 pm

You are the fucking man. Thank you SO much!

Avatar

Bogdan ROMANIA

March 18th, 2011 at 5:45 pm

Thank you !!!! solved the problem. I was smashing my brain with magento.

Avatar

Richard Feraro

March 18th, 2011 at 5:52 pm

Cool! Thanks for the feedback :)

Avatar

Kinney UNITED STATES

March 24th, 2011 at 5:13 am

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.

Avatar

Richard Feraro UNITED STATES

March 24th, 2011 at 3:35 pm

Hello Kinney,

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

Regards

Avatar

Jimains UNITED KINGDOM

March 31st, 2011 at 4:35 pm

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

Avatar

Richard Feraro UNITED STATES

April 1st, 2011 at 10:58 am

Thank you too Jimains for the feedback :)

Avatar

Artur

May 6th, 2011 at 2:54 am

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

Avatar

Jay

May 6th, 2011 at 8:01 am

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 :-)

Avatar

Richard Feraro

May 6th, 2011 at 11:40 am

Hey Artur :-) Thanks for the feedback :-)

Avatar

Richard Feraro

May 6th, 2011 at 11:47 am

Thanks for the feedback :-)

Avatar

Brian

May 15th, 2011 at 8:33 am

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?

Avatar

Richard Feraro MALAYSIA

May 15th, 2011 at 10:46 pm

What’s the error you’re getting?

Avatar

Brian

May 15th, 2011 at 11:10 pm

No error message. The page just reloads to a blank login form.

Avatar

Richard Feraro MALAYSIA

May 16th, 2011 at 5:47 pm

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

Avatar

Brian

May 16th, 2011 at 6:56 pm

The URL is:
http://xxx.xxx.xxx.xxx/index.php/admin/index/index/secretkey/

The leading x’s are the IP address, and it is trailed by the encryption secret key.

Avatar

Brian

May 16th, 2011 at 6:57 pm

sorry, that should be /index.php/admin/index/index/key/secretkey/

Avatar

Brian

May 16th, 2011 at 10:48 pm

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.

Avatar

Richard Feraro UNITED STATES

May 18th, 2011 at 6:12 am

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

Avatar

Brian

May 18th, 2011 at 7:41 pm

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.

Avatar

Matthew UNITED STATES

May 26th, 2011 at 12:53 pm

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!

Avatar

Richard Feraro

May 26th, 2011 at 1:18 pm

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.

Avatar

Mike NEW ZEALAND

June 28th, 2011 at 4:13 pm

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.

Avatar

Richard Feraro

June 30th, 2011 at 8:24 pm

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?

Avatar

Small Studio AUSTRALIA

July 14th, 2011 at 10:14 am

This solution was perfect for me on a mac with Nirav’s addition. Thanks!

Avatar

Richard Feraro UNITED STATES

July 14th, 2011 at 2:39 pm

Thanks for the feedback! :)

Avatar

kdmonk1 UNITED STATES

July 30th, 2011 at 9:08 pm

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.

Avatar

Richard Feraro PHILIPPINES

August 8th, 2011 at 5:07 pm

Have you tried it again? It may be that the service is down or something?

Avatar

Christian Ludwig GERMANY

August 9th, 2011 at 4:25 am

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

Avatar

Richard Feraro UNITED STATES

August 9th, 2011 at 11:29 am

That’s good to hear Christian. Thanks for sharing too :)

Avatar

paul UNITED KINGDOM

August 22nd, 2011 at 11:37 pm

That is perfect. thank you so much!!

Avatar

Richard Feraro PHILIPPINES

August 24th, 2011 at 10:08 pm

You’re welcome :)

Avatar

york AUSTRALIA

September 3rd, 2011 at 9:02 am

This is the most simple and best solution, thank you! It works! ! Thank you!

Avatar

Richard Feraro PHILIPPINES

September 3rd, 2011 at 5:29 pm

Thanks :)

Avatar

Amay INDIA

September 8th, 2011 at 10:27 pm

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

Avatar

Richard Feraro

September 8th, 2011 at 10:54 pm

What have you done so far?

Avatar

Ashfaque

September 9th, 2011 at 10:47 pm

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 :-)

Avatar

Richard Feraro PHILIPPINES

September 14th, 2011 at 11:51 pm

Did you check the directory permission?

Avatar

Sankar INDIA

October 11th, 2011 at 7:16 pm

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

Avatar

How to fix the “Illegal scheme supplied, only alphanumeric characters are permitted” Magento error on Localhost using HTTP (fresh install) - My Silly Point of View UNITED STATES

November 1st, 2011 at 4:56 am

[...] will need to follow the instructions in my previous post but instead of using HTTP, you must access the admin page via HTTPS after you applied the code [...]

Avatar

Savey CHINA

November 3rd, 2011 at 9:44 am

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

Avatar

Savey CHINA

November 3rd, 2011 at 9:55 am

But the secure url is invalid

Avatar

Richard Feraro PHILIPPINES

November 3rd, 2011 at 12:15 pm

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.

Avatar

Roselin INDIA

November 25th, 2011 at 7:55 pm

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.

Avatar

Richard Feraro

November 25th, 2011 at 9:06 pm

Do you get any error? How about the url? What does it look like after you login?

Avatar

Roselin INDIA

November 26th, 2011 at 12:59 pm

First of all thanks for your reply. I haven’t get error after login. But login page only loaded. Cookie has not set, after login in to magento.

While login url is
http://192.168.1.2/mopl/index.php/admin/

After login url is
http://192.168.1.2/mopl/index.php/admin/index/index/key/191a6bd173b31905c63dd9d13f0603b1/

Thanks,

Avatar

Donny Bayton

December 3rd, 2011 at 10:50 am

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

Avatar

Peter UNITED STATES

December 3rd, 2011 at 11:21 am

Hi Richard

I am having the same issue as above but Im not on a local host, im on a shared host.

I try logging into: http://www.dirtycouture.com/admin but when i enter my username and pass i get rerouted to:
http://www.dirtycouture.com/index.php/checkout/index.php/admin/dashboard/index/key/66afee3d15f60011b3955058514af814/

Should I be altering my Varien.php file as well even though my magento cart is not on a local host?

Thank you!!

Avatar

Richard Feraro PHILIPPINES

December 4th, 2011 at 6:49 am

What’s the error in the page after you have been rerouted?

Avatar

Richard Feraro PHILIPPINES

December 4th, 2011 at 6:51 am

The fix here only applies to blogs running via localhost. Either your username or password is correct or you may need to clear your cache.

Avatar

Richard Feraro PHILIPPINES

December 4th, 2011 at 6:53 am

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.

Avatar

Jay

December 6th, 2011 at 4:11 pm

Does this work on Magento version 1.4.2?

Avatar

Richard Feraro PHILIPPINES

December 6th, 2011 at 4:12 pm

Yes

Avatar

Kathy

December 15th, 2011 at 1:44 pm

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?

Avatar

Kathy

December 15th, 2011 at 2:38 pm

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.

Avatar

Richard Feraro CANADA

December 15th, 2011 at 10:46 pm

I’m glad you were able to find the solution to your Magento problem. Thanks for sharing it too :)

Avatar

Clement MALAYSIA

December 22nd, 2011 at 2:17 pm

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?

Avatar

Richard Feraro PHILIPPINES

December 23rd, 2011 at 7:14 am

It could be different depending on the machine you are using. Take note that we are referring to the local machine you are using. If it’s Mac OSX, then it’s different.

Avatar

Diana BELGIUM

December 31st, 2011 at 1:23 am

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 ::)))

Avatar

Richard Feraro

December 31st, 2011 at 2:44 am

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 :)

Avatar

Chris Forscutt UNITED KINGDOM

January 3rd, 2012 at 11:53 pm

or you could just try checking the ‘web/cookie/cookie_domain’ path in the ‘core_config_data’ table

Avatar

Chris SINGAPORE

January 4th, 2012 at 10:28 am

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.

Avatar

Bloosh PAKISTAN

January 21st, 2012 at 7:24 pm

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

Avatar

Richard Feraro

January 26th, 2012 at 2:55 pm

What version of Magento is it?

Avatar

Chris SINGAPORE

January 30th, 2012 at 9:31 am

I’m using CE 1.6.0

Thanks in advance, richard.

Avatar

Mohammad Adeel AUSTRALIA

February 11th, 2012 at 10:32 pm

Thank you Richard and Christian Ludwig! it worked for CE 1.6.2.

Avatar

Mich G. UNITED STATES

March 15th, 2012 at 3:25 am

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.

Avatar

Richard Feraro PHILIPPINES

March 17th, 2012 at 10:05 am

Thank you Mich ;)

Avatar

Jill UNITED STATES

March 24th, 2012 at 10:17 am

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!

Avatar

vishal

April 11th, 2012 at 6:20 pm

Thanks that Code Perfectly work

Avatar

tuba UNITED STATES

May 1st, 2012 at 3:38 am

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?

Avatar

robert BELGIUM

May 17th, 2012 at 11:53 pm

Great stuff, works like a charm!

Avatar

Jeff UNITED STATES

June 29th, 2012 at 1:28 pm

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.

Avatar

Richard Feraro

June 30th, 2012 at 12:33 pm

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.

Avatar

Jeff UNITED STATES

July 3rd, 2012 at 2:43 pm

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.

Avatar

Allan SRI LANKA

July 6th, 2012 at 12:05 pm

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

Avatar

graham UNITED KINGDOM

July 17th, 2012 at 1:05 am

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

Avatar

Rahul

July 18th, 2012 at 3:24 pm

Vry Vry Thanks 2 U … Like Ur short and sweet code to overcome this prob.

Avatar

Jens

August 5th, 2012 at 9:30 pm

I love you!

Avatar

Stefano ITALY

August 29th, 2012 at 6:04 am

Thank you very much for your instructions, simple and usefull. thanks!

Avatar

abhishek k. AUSTRALIA

September 2nd, 2012 at 4:59 am

thanx ! you r great bro ! this is destination finally ! no words !!! thanxxxx !!!!

Avatar

jamb GERMANY

September 12th, 2012 at 1:34 am

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..’#?!

Avatar

bhanupratapreddy INDIA

September 13th, 2012 at 10:41 pm

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

Avatar

chethan AUSTRALIA

October 9th, 2012 at 9:01 pm

Thx bro huge releif

Avatar

Abhiraj

October 14th, 2012 at 4:22 am

Thanks for dis article… it works… thank yuo so much…

Avatar

John Ortiz

November 6th, 2012 at 7:55 am

Thanks for this solutions!

I have only changed the source code that you recommended, and everything is working!

Avatar

prashanth

November 9th, 2012 at 11:40 am

richard thanks for your help atlast found one great solution. thank you once again :) :)……….

Avatar

john

November 29th, 2012 at 1:05 am

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?

Avatar

Richard Feraro

December 4th, 2012 at 3:18 am

Thank you ;-)

Avatar

Richard Feraro

December 4th, 2012 at 3:20 am

Great! ;-)

Avatar

Richard Feraro

December 4th, 2012 at 3:21 am

Thank you too

Avatar

Iran

January 12th, 2013 at 12:07 am

from metalbaz.com i say you are awesome

Avatar

mahmoudsaid TURKEY

January 24th, 2013 at 2:57 am

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

Avatar

utopian GERMANY

January 24th, 2013 at 5:10 pm

Thany to this post and Nirav i got it working on an Apple Machine using Xampp, Magento 1.6.1

Avatar

ankur AUSTRALIA

January 29th, 2013 at 7:29 pm

thanks

Avatar

Dee Gonzalez UNITED STATES

January 30th, 2013 at 9:46 pm

Thanks so much. This prevented me pulling my hair out and swearing. Saved me time. :)

Avatar

Richard Feraro AUSTRALIA

January 31st, 2013 at 11:09 am

Thanks too!

Avatar

Sriniwas

February 5th, 2013 at 2:21 pm

this works real good… cheers mate

Avatar

trend kerudung hijab indonesia 2013

February 11th, 2013 at 3:18 pm

thanks its work for me….

Avatar

Kits INDIA

February 16th, 2013 at 6:19 pm

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?

Avatar

Jinxed AUSTRALIA

February 21st, 2013 at 10:31 am

Hi This solution was working but all of a sudden has stopped working. I am using EE 1.10

Avatar

pardeep

February 23rd, 2013 at 2:07 pm

Thanks.it solved my problem.

Avatar

Richard Feraro AUSTRALIA

March 1st, 2013 at 8:38 am

Have you checked if the upgrade replaced the file you updated?

Avatar

Richard Feraro AUSTRALIA

March 1st, 2013 at 8:39 am

Thank you for the feedback

Avatar

Martin NEW ZEALAND

March 1st, 2013 at 10:15 am

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

Avatar

Richard Feraro AUSTRALIA

March 1st, 2013 at 10:17 am

Thank you Martin for the feedback :)

Avatar

Richa INDIA

March 12th, 2013 at 10:40 pm

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.

Avatar

Richard Feraro

March 13th, 2013 at 12:41 am

Thanks for the info ;-)

Avatar

Kamil Waheed

March 13th, 2013 at 9:25 pm

Nirav’s technique worked brilliantly on Mac OS X.

Avatar

Mark Richard INDIA

March 30th, 2013 at 5:21 pm

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.

Avatar

yogesh INDIA

April 2nd, 2013 at 9:07 pm

awesome thank sir…..

Avatar

kuntal

April 7th, 2013 at 1:15 am

thanks its worked

Avatar

andrewdotcoza

April 10th, 2013 at 6:16 pm

Wow! Thanks to you and Nirav! You saved me a lot of time. :-)

Avatar

alvin

April 15th, 2013 at 4:46 pm

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!

Avatar

Nayan INDIA

April 25th, 2013 at 2:41 pm

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

Avatar

Vishal INDIA

April 29th, 2013 at 1:28 pm

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!)

Avatar

Rushh INDIA

May 13th, 2013 at 8:09 pm

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.

Avatar

Ammu INDIA

May 17th, 2013 at 6:42 pm

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

Avatar

vkwave INDIA

June 20th, 2013 at 7:54 pm

Mind blowing. Solved in a single hit. Many thanks for sharing.

Avatar

Andrew Jackson UNITED STATES

June 25th, 2013 at 10:40 pm

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.

Avatar

Hass

July 4th, 2013 at 10:07 am

Works fine, thank u Richard.

Avatar

Ravi Prakash

July 8th, 2013 at 1:11 pm

Hey it works…….

Thank u Guys !!!!!!

Avatar

Josch GERMANY

July 17th, 2013 at 5:13 am

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

Avatar

Richard Feraro PHILIPPINES

July 18th, 2013 at 10:58 pm

Hi Josch, did you update the base and secure url found in the core_config_data table to match the new location?

Avatar

Josch GERMANY

July 23rd, 2013 at 5:09 pm

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

Avatar

Richard Feraro PHILIPPINES

July 23rd, 2013 at 5:17 pm

Is there any error being displayed? If you’re accessing it via VPN, I assume it should be http://localhost/magentotest/magento ?

Avatar

Josch GERMANY

July 23rd, 2013 at 7:00 pm

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

Avatar

SS INDIA

August 5th, 2013 at 5:26 pm

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

Avatar

SS INDIA

August 5th, 2013 at 5:27 pm

sorry for my bad english it is magento 1.7.0.2 version

Avatar

Punit INDIA

August 21st, 2013 at 10:45 pm

Hey Richard,

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

Avatar

Daniel NETHERLANDS

August 31st, 2013 at 9:39 pm

Yes, this works. Really a nice and good detailed article. I am very satisfied.

Avatar

Queenie PHILIPPINES

September 27th, 2013 at 9:34 am

Been through to many forums and blogs. Finally, I found the right one. Many thanks!!

Avatar

Pierre Guivarch

October 17th, 2013 at 4:18 am

Worked for me as well. Thank you so much Richard for the hack!

Avatar

cazuu COSTA RICA

October 18th, 2013 at 7:37 am

Great It works :) thanks

Avatar

Cheng zhao UNITED STATES

November 3rd, 2013 at 6:37 am

Very good,it works. it is very helpful,thanks so much…..

Avatar

Nikhil

December 20th, 2013 at 8:35 pm

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

Avatar

Richard Feraro PHILIPPINES

December 22nd, 2013 at 12:45 am

What’s the URL you’re getting after you try signing in?

Avatar

Tuhendu

February 8th, 2014 at 5:45 pm

Thanks a lot! great help!

Avatar

ronak

March 26th, 2014 at 12:36 pm

thanks buddy you are life saver …..it worked for me too!!!

Avatar

annoyed new user GERMANY

May 8th, 2014 at 9:38 pm

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?

Avatar

Hiral

August 13th, 2014 at 8:48 pm

thank u so much…its works for me..!!

Comment Form

About my blog

This blog is targeted towards all levels of developers and also designers. Various topics are discussed such as Magento, PHP & MySQL, jQuery, WordPress, CSS and HTML.

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 10 other subscribers

PayPal Donation

WordPress + Magento

Proudly Pinoy!

Proudly Pinoy!

Recent Trackbacks

Archives

Disclaimer

All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or my mom.