Magento – Login Loop in Magento 1.9

adminmagento-1.9

I'm getting the infamous login loop in a fresh 1.9 install

The install is on a vagrant machine and it is accessed via the url: http://magento9.local locally.

I have cleared /var and cookies numerous times, reset all my permissions numerous times, its a clean install, theres no modules, i even tried the core file hacks (basically everything in this thread Magento 1.9 Can’t login to admin panel!)

I destroyed the instance and started again, and still can't get past the log in,

Home page works fine. n98-magerun

Magento was intsalled via

I am completely at a loss

Best Answer

Make sure you have specified a cookie domain name that is relative to your environment or the cookie cannot be set. admin->system->configuration->web->cookie domain You should also try and clear your browsers cache and cookies to ensure such as well. Some instances I've seen leaving the domain blank will work as well but most likely falls back to PHP internal functions to determine the domain to attempt to set when writing the cookie.

It appears there is an exception in Core as well during session handling that simply throws an empty exception in a condition of validation of the session.

Which may explain the redirect to the login afterwards with no indication of why.

You can validate this as well with viewing the cookies in the browser to determine if an adminhtml or frontend cookie is being set. As well as attempting to login to the customer side.

Also, as Alan mentioned in the linked article:

You're using the localhost as your server domain, and using a version of webkit that has trouble/bugs setting cookies for localhost in some situations.

domain.local may not be a valid TLD for your OS/Browser, Personally this is why I always map my local environments as simply local.domain.com to prevent any issues as such, as well as a lot of 3rd party modules validate domain names for licensing, this helps ease this problem as well.

Related Topic