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.
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.
At this point you should be able to login now with your admin username and password using localhost as your domain.
Wow! It Works. Thanks!
You’re welcome Lawrence π
works on π thx!!
thanks too for the feedback π
Yep, it worked! thanks
@Idk2good: You’re welcome π
Great!. It works!! π
Thank you Albert π
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…
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.
It works!!! Finally!! *_* Thank you VERY MUCH!!!!
You’re welcome :p
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
What’s your Magento version?
and by the way, there is no cookies tab on my firebug adds on.. any help ?
It’s an additional extension for Firebug.
https://addons.mozilla.org/en-US/firefox/addon/6683
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.
Thank you for the feedback Kent! π
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 π
Hi Mark! Thanks for the feedback. Glad to help you π
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();
}
Restore your code to it’s original version then follow my instructions in the post above.
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
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 π
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
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‘
I found out that version 1.3.2.4 has a different Varien.php. Follow the instructions below:
replace it with these code:
Thanks Richard
For providing a more secure way to log into Admin Panel on a local machine
Thank you too Anil for the feedback π
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
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.
After searching quite a little time, i found this!
GREAT !!!
Thanks
Andreas
Thanks for the feedback Andreas! π
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
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
Nope no luck..Still having same problem
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?
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?
What’s your Magento version and how many instance of Magento do you have in your hosting?
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.
Delete all the contents of ‘sessions’ and ‘cache’ folders found within ‘/var’ folder, then try it again.
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?
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?’
No i didnt delete the folder…just the content of it.
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
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.
if you’re having doubts of showing the values, just upgrade your Magento to the latest version.
Actually i am having problem posting long config data i have to this blog because it is not allowing me to post it.
I did the same for session folder
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 π
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.
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?
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.
Yes I am using firefox. I keep clearing cache but same problem. I have tried in IE also with no success
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!
So it’s a configuration issue. I’m glad that you were able to fix it π
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?
Hello evangeline,
The best way to do it is download the file below to your computer and do the editing:
the upload it to this location (create the folders if it doesn’t exists):
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:
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
try adding a ‘/’ at the end of your Unsecure Base URL so it would look like http://www.electroviva.com/
[…] 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-…. […]
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!
Thank you Bozz for the feedback! I’m glad that the post did help you.
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
Hello Shiro! Thanks for the feedback π Keep on reading!
you’re awesome. THANKS!
Thanks Clara! Keep on reading π
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.
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.
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..
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.
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.
Thanks Ami for the feedback. Keep on reading! π
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….
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 π
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.
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
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.
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?
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?
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
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.
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:
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!!!
Man wich line you comment out , cant make it work on version 1.4.1.1
It’s just the same as version 1.4.0.1. Read the instruction found in this article.
hey! finally you saved my hair. i’ve spent two days to find out. thank uuuuuuuuuuuuuuuuuuuuuuuuuuuuu very much
Thanks for the feedback Satheesh! I’m glad that you still have your hair :p
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,
What’s your Magento version Tedros?
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())) {
}
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.
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,
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’
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?
Magento has its own way of properly uninstalling an extension. Please refer to the extension developer of Magento ArtsOnIt for further details.
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)
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.
I found out that because the
httponly
key from $cookieParams array is missing like what this error says: Undefined index: httponlyI 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.Wow man! Thanks so much. I nver thought with the new version of Magento, this problem still exist.
Thanks again.
Thanks for the feedback Archie π Keep on reading!
Hi Richard thanks for your posts.Finally implemented Magento CE ver 1.4.1.1
Thanks Mayank. I’m glad that the post did help you π Keep on reading!
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.
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.
What did you change at line 77? I only mentioned to update line 96 in this article.
Yes, I changed the line 77 as well, but still got the error message.
No, what I meant was, what did you change in line 77? The only thing found in line 77 is the code below:
May I see your code from line 76 to line 99 of Varien.php?
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?
For Magento version 1.4.1.1 Try doing what cfemocha did here.
Funcionou!..
Thanks for the feedback π
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 !
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”.
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.
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.
I guess i will probably need to talk to Blue Host. Thank you very much for your help. Richard. I really appreciate it.
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!
That’s great Nirav! Thanks for the feedback for Magento users running it in Apple machine.
That worked for me! I was worried I was going to have to purchased MAMP Pro there for a second!
Thanks for the feedback Mark π
Thanks !! This solved my problem.
Glad to hear that π
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
getDomain()
instead ofgrtDomain()
thanc Rich it worked
now hw comes my when i try to images at the backend i fail to see in the front end
ITS GIVING ME HARD TIME TRY TO LOAD IMAGES FROM THE BACK END
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?
Tried many solutions unsuccessfully. Finally Richards solution works well on windows xampp, magento version 1.4.1.1
Thanks a lot
Thank you Andi for the feedback.
Keep on reading π
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
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.
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
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:
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
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?
Thanks for this post. It resolves my problem in localhost
Thanks for the feedback Sandhya π
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
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?
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 !
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.Another thing i forgot is how can one upload magento files using xampp-win32-1.6.6a-installer failed to that thanks again
If it is a local machine, you just have to copy the Magento files in either
htdocs
orwww
directory, whichever is available in your setup.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?
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.
Thanks boss
Thank you too π
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
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.
Could it be because of my php.ini or htaccess file that this error is occurring?
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!
Glad you’re site is fixed. Thank you too.
so good,IMPORTANT FOR ME!THANK YOU!
Thanks for the feedback π Keep on reading!
You helped me a lot dude…! i was googling for days searching for bug fixes. Thank YOU!
That’s good to hear James π
Thanks for the feedback!
Thanks a lot,
This way to fix this problem seems better to me than the “adding a point in the URL” solution
Thanks for the feedback Charles π
Keep on reading!
HI sir Richard,
Am applied ur code in magento 1.3.2.4…Now admin panel work nice…
Thanks a lot….
That’s good to hear π
Thanks for the feedback.
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.
Thank you Tiago for the info π
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
Does it happen also in invalid login or only during successful logins?
your the man thanks!!!
Thank you π
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.
What’s the URL in the address bar after you have clicked the Login button?
its the same:
https://chatwindirect.com/admin
i tried again and get:
https://chatwindirect.com/index.php/admin
If you have access to your database, go to table
core_config_data
and findweb/secure/base_url
in the path column. What’s string in the value column?https://chatwindirect.com
There must be a trailing slash “/” at the end of it.
https://chatwindirect.com/
sorry richard, but there is a trailing slash i missed that! sorry.
https://chatwindirect.com/
Let’s check if the SSL certificate is the culprit. In
core_config_data
table, locate theweb/secure/use_in_adminhtml
in the path column and set the value column to0
, go tohttp://chatwindirect.com/admin
(take note that you’re not usinghttps
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
andvar/cache
.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
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.
Sorry for the late response(Xmas). I am trying your suggestion right now.
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..
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
richard, we decided to re-install. all works for now. thanks for your help.
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
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);
}
Sorry…forgot to mention that it’s:
Magento 1.4.2.0
Apache 2.2.17
PHP 5.2.11
found my issue…I misread and replaced lines 96-98. Duh
Hehe I was about to say that in my reply to you π
Nice one man!
This is is annoying every time but it’s a nice clean fix!!
Peace
Thank you Alex π
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): …
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 themagento-core/Mage_Core_Modules
in Magento Connect.Thank you.
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
Sorry the admin URL is
http://www.teeshop.com.au/shoppingcart/magento/index.php/admin
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.
I edited my previous reply. See if that will help you.
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.
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
Thanks Richard! I reverted my code and made the change through the admin.
Cool!
You are the fucking man. Thank you SO much!
Thank you !!!! solved the problem. I was smashing my brain with magento.
Cool! Thanks for the feedback π
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.
Hello Kinney,
It’s different from the post. It really means your credentials are incorrect.
Regards
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
Thank you too Jimains for the feedback π
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
Hey Artur π Thanks for the feedback π
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 π
Thanks for the feedback π
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?
What’s the error you’re getting?
No error message. The page just reloads to a blank login form.
How about the URL? Can you post the URL found in the address bar when the page is blank?
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.
sorry, that should be /index.php/admin/index/index/key/secretkey/
Have you tried disabling the Add Secret key to urls in System->Configuration->Admin panel->Security?
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.
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.
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!
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.
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.
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?
This solution was perfect for me on a mac with Nirav’s addition. Thanks!
Thanks for the feedback! π
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.
Have you tried it again? It may be that the service is down or something?
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:
I don’t know if the entry exists in 1.4 but in 1.5 it can be set and changed.
Christian
That’s good to hear Christian. Thanks for sharing too π
That is perfect. thank you so much!!
You’re welcome π
This is the most simple and best solution, thank you! It works! ! Thank you!
Thanks π
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
What have you done so far?
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 π
Did you check the directory permission?
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
[…] 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 […]
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
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.
But the secure url is invalid
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.
Do you get any error? How about the url? What does it look like after you login?
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,
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.
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??
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.
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!!
What’s the error in the page after you have been rerouted?
Does this work on Magento version 1.4.2?
Yes
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?
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.
I’m glad you were able to find the solution to your Magento problem. Thanks for sharing it too π
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?
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.
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 ::)))
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 π
or you could just try checking the ‘web/cookie/cookie_domain’ path in the ‘core_config_data’ table
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.
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();
}
What version of Magento is it?
I’m using CE 1.6.0
Thanks in advance, richard.
Thank you Richard and Christian Ludwig! it worked for CE 1.6.2.
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.
Thank you Mich π
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!
Thanks that Code Perfectly work
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?
Great stuff, works like a charm!
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.
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.
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.
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
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??
Vry Vry Thanks 2 U … Like Ur short and sweet code to overcome this prob.
I love you!
Thank you very much for your instructions, simple and usefull. thanks!
thanx ! you r great bro ! this is destination finally ! no words !!! thanxxxx !!!!
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..’#?!
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
Thx bro huge releif
Thanks for dis article… it works… thank yuo so much…
Thank you too
Thanks for this solutions!
I have only changed the source code that you recommended, and everything is working!
Great! π
richard thanks for your help atlast found one great solution. thank you once again π :)……….
Thank you π
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?
from metalbaz.com i say you are awesome
thanks .
after 12 hour for solving this problem i found this article and magento is working now. amazing website.
Thany to this post and Nirav i got it working on an Apple Machine using Xampp, Magento 1.6.1
thanks
Thanks so much. This prevented me pulling my hair out and swearing. Saved me time. π
Thanks too!
this works real good… cheers mate
thanks its work for me….
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?
Hi This solution was working but all of a sudden has stopped working. I am using EE 1.10
Have you checked if the upgrade replaced the file you updated?
Thanks.it solved my problem.
Thank you for the feedback
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
Thank you Martin for the feedback π
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.
Thanks for the info π
Nirav’s technique worked brilliantly on Mac OS X.
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.
awesome thank sir…..
thanks its worked
Wow! Thanks to you and Nirav! You saved me a lot of time. π
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!
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
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!)
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.
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
Mind blowing. Solved in a single hit. Many thanks for sharing.
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.
Works fine, thank u Richard.
Hey it works…….
Thank u Guys !!!!!!
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
Hi Josch, did you update the base and secure url found in the core_config_data table to match the new location?
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
Is there any error being displayed? If you’re accessing it via VPN, I assume it should be http://localhost/magentotest/magento ?
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
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
sorry for my bad english it is magento 1.7.0.2 version
Hey Richard,
I have applied the above mentioned solutions, but still not able to login to magento frontend. still getting invalid login error
Yes, this works. Really a nice and good detailed article. I am very satisfied.
Been through to many forums and blogs. Finally, I found the right one. Many thanks!!
Worked for me as well. Thank you so much Richard for the hack!
Great It works π thanks
Very good,it works. it is very helpful,thanks so much…..
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
What’s the URL you’re getting after you try signing in?
Thanks a lot! great help!
thanks buddy you are life saver …..it worked for me too!!!
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?
thank u so much…its works for me..!!
I have found the same method here.
http://stackoverflow.com/questions/13860936/magento-cant-login-in-admin-with-right-username-and-password
Provided by the user Chetan
I did that in his way and it solve the problem yesterday
however when I try to login the admin the problem happen again
My internet connection is very good, I can easily open the home page and inner page.
it take about 1 minute to login to the admin, meanwhile it is very hard to add the product to the shopping bag, until this problem fixed.
That is very curious.
Do you have any suggestion
Undo the script you did, and try my suggestion.
Regards,
Hi Richard, hi guys!
I’m in a pretty stupid situation and I can’t get out of it. Using Magento 1.7, I initially had some issues with the add-to-chart funcion on chrome browser working badly.
I’ve started to try some solution playing with the Cookie Lifecycle time from de admin panel and the varien.php file.
The problem is, at some point I’ve replaced the cookie lifecycle time value from the admin (3600 to 1), and after that, every time I’m logging into the admin, after just a click I’m automatically disconnected.
I can’t go back to the default 3600 or any other value cause it doesn’t let me the opportunity to save my change (it disconnects and go back to the login page);
Is there a chance you could help me to find a way to access the admin and having enough time to change the cookie lifetime value I’ve set to 1 ?
Thank you for your help, I’m quite disasperate now.
Guillaume
Hi Guillaume,
Connect to your database and find the table named ‘core_config_data’ and search for the record with ‘path’ = ‘web/cookie/cookie_lifetime’. Change the value to 3600.
I got the following error??
connect error package file is invalid
invalid or empty login for author #1
Thanks!
Thanks, the update queries just solved 2 hours of headache
Dude ! thanks and your thing works for me.. cheers to you
Bug still present in 2016!
You just saved me a full clean reinstallation! Thanks!
Thanks π
in 2016 and i have kind of the same problem.
I have a magento site. I used to be able to log in via the admin login page. Now I am unable to. I donβt know what happened to cause the problem but the symptoms are the same as the ones you describe in your post. If I log in with my correct username/password i am immediately redirected back to the login page with no error message. If i log in with an incorrect username password I get an error message saying my username or password is invalid. I have tried many of the solutions suggested on this blog post and others, including commenting out various lines in my /app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file, making sure that my web/cookie/cookie_domain entry in the database is set to my site domain, setting web/secure/use_in_adminhtml to 0, clearing the var/cache folder and var/session folders more times than I can count, etc.
I hope you can help me. Thanks in advance.
Have you installed the recent Magento patches? There are form key validation now so try clearing the browser cookies and try again.