Posted by nick | Posted in Magento, Uncategorized | Posted on Feb 06 2009
Tags: magento
I experienced a problem just after my Magento install where the page would simply redirect back to the login without displaying an error message. I’d login using the user credentials I just created during the install and I also tried using the default user “admin” with password “123123″ . The trick was that I was installing on localhost and for some reason a cookie was not being set for the session. I have other sites requiring a cookie on localhost, but Magento seems to have a problem with it.
The solution is to add the following line to your hosts file so you can access your localhost as www.localhost.com.
C:Windows\System32\drivers\etc\hosts (edit this file in notepad)
127.0.0.1 magento.localhost.com www.localhost.com
Also worth mentioning, if you need to reset a password manually in the database use the following:
UPDATE admin_user SET password=MD5(‘mypassword’) WHERE username=‘admin’;
If none of the above works, install the browser Opera and use it. Opera seems to work out of the box whereas IE, Firefox, and Google Chrome do not.
Wow, that is the craziest thing. I tried everything, but the only thing that worked was using Opera. Weird! Thanks!
Hi All,
Everything works fine with Opera.
Changing host names can be annoying for other people as they will also have to add the hostname change to see the Magento site.
You can also use your
- IP (if it is fixed),
- 127.0.0.1 - For local uses
- Computer Name (Doesn’t allow you by default so just use locahost and change it in the config data table later- See below)
If you ever need to change this just go to the magento database core_config_data and change the 2 URLS of magento
cannot login admin magento on localhost.
could you help me at this time?
Hey Folks,
There is an other way to fix that problem http://www.magentocommerce.com/boards/viewthread/42823/
[...] more digging (thanks to Nick Bartlett’s Blog) it seems that Firefox and IE have problems storing cookies with Magento. Thanks to a tip in the [...]
Dude,
UPDATE admin_user SET password=MD5(‘mypassword’) WHERE username=‘admin’;
does the job!
“hi,
it works when i just browse http://www.localhost.com/magento/ but if i tried to put http://www.localhost.com/magento/admin it automatically redirects to http://localhost/magento/admin and username password doesn’t work. Do I need to do some extra settings?”
This is happening for me as well. Going to 127.0.0.1 or http://www.localhost.com used to work, but I just updated to the latest version, and admin login just redirect to localhost every time with invalid u/p.
Anyone has a fix?
When I am testing more, I am unable to create a customer account also from one PC on to the server where the magento is installed. Please help.
Hi,
I am not able to access and do operations on my LAN through the normal storefront as well. E.g. If I try to add the item in the shopping cart instead of adding the item, it just give me the message that there is no item in the shopping cart. If I use the installation on the server machine where Magento is running the storefront works okay. So it is just that if I install Magento on One Machine and try to access it through another machine on lan, it give me this trouble of accessing the admin login as well as normal store operations.
Please help.
I tried all of above and works for me only for the server machine where the magento is installed. however if I try to access the magento from other pcs in the LAN it gives me the same problem. I am not even able to perform normal operations on the store front. Please help.
hi,
it works when i just browse http://www.localhost.com/magento/ but if i tried to put http://www.localhost.com/magento/admin it automatically redirects to http://localhost/magento/admin and username password doesn’t work. Do I need to do some extra settings?
Don’t forget to delete all of the files in /var/cache and /var/session
This was happening to me, and after I deleted the cache it was rebuilt correctly and I could login fine.
I set up a virtual host for my install after trying the 127.0.0.1 trick, but you probably just need to delete the cache.
Hope that helps,
James
No need to change anything after 2 wasted hours! all you have to do on local host is use opera as your browser and it stores the cookie
That is the url: http://localhost:8888/magento/index.php/admin/
works fine on mac in Mamp as long as you use opera to access it
great it worked !! U rock man .
Thank you for your solution. it worked great
Hi again,
My mistake. I should also change the url, from http://localhost/magento/index.php to http://www.localhost.com/magento/index.php
It works now. Thanks!
I just tried v1.3.1 and I did the same thing above.
Somehow, it is still failure. Is there any change again in etc/hosts file?
Thanks guys!
thanks a lot for the help!!!problem fixed
Thanks Nick,
That localhost change fixed my magento right up… I owe you a beer!
cheers,
Tony
Thanks
the procedure is correct for resetting the password but the correct syntax is like this:
UPDATE admin_user SET password=MD5(’newpassword’) WHERE username=’oldusername’
and u do not need to do any thing with
“C:\Windows\System32\drivers\etc ” file.
I had this same problem but I use a Mac. Any idea how this fix would apply to an Apple user? Thanks
Thanks! This worked like a charm.
This problem seems to be happening with 1.2.1 and 1.2.1.2.
For osx and Linux users: modify /etc/hosts as indicated in the post, but make sure you do not overwrite the entry that says
127.0.0.1 localhost
because that entry is used when booting up the system.
Just add your entry after this line.
thanks for that helped
This worked perfectly! Thanks!