Magento 1.9 Can’t login to admin panel!

While it may offer you a temporarily solution, you should considering not modifying the core code like that to solve problems. Changing the source code of an application will create problems that are much more difficult to track down.

There's a number of different issues that cause the errorless admin login behavior you're seeing, but they all go back to Magento not being able to set or read the session cookie. Magento uses sessions to pass error messages between pages — that's why you don't see an error message. Magento also uses sessions to store the "is logged in" value, so not setting sessions also causes the core error behavior.

Possible causes include

  • Local computer time vs. server time mismatch, causing instant cookie invalidation. Make sure your server time is correct.

  • Incorrect permissions on var/session, preventing session files from being saved

  • Incorrect configuration of database/redis/other session storage, preventing saving of session values

  • A module is instantiating sessions to early, preventing the correct session names from being set

  • You're a developer using multiple URLs and have multiple cookie domains

  • Another developer has somehow modified app\code\core\Mage\Core\Model\Session\Abstract\Varien.php, creating a hard to track down bug

  • The cookie domain in System -> Configuration -> Web -> Session Cookie Management doesn't match the actual site domain.

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

The short term fix is to just delete your cookie for the domain. That's often enough to solve the problem. If it persists, figure out which of the above reasons is the reason for your error, and take steps to address it (fix permissions, etc.)


I'm having the same symptoms on some Magento installations(not only 1.9). In my case, it happens only in Chrome. I'm fixing this by logging in Firefox/Safari/Opera, and changing 'Use HTTP only' to 'No' in 'Session Cookies Management' of the 'Web' settings.

See Magento's backend screenshot with cookies settings


I had this problem too. Turned out sessions couldn't get written to var/session, even though the directory itself is set to 0777. Magento created session files, but they all remained zero bytes.

Changing session storage from files to db solved the problem for me.