Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed Magento 1.9. It was working well for a week. Suddenly yesterday, when I tried to login to the Magento admin panel and I typed username and password, clicked Login button and nothing happened. The page refreshes and that’s all. No error or any other messages.

If I entered wrong username or password, It shows error.

After I googled about this issue, I was recommended to comment following lines in:


/* to solve login issue */
  /*if (!$cookieParams['httponly']) {
  if (!$cookieParams['secure']) {
  if (!$cookieParams['domain']) {

if (isset($cookieParams['domain'])) {
  $cookieParams['domain'] = $cookie->getDomain();*/ //I have commented these lines

And for some older versions below was recommented in the same file.

$cookieParams = array(           
    'lifetime' => $cookie->getLifetime(),           
    'path'     => $cookie->getPath(),           
    //'domain'   => $cookie->getConfigDomain()           
    //'secure'   => $cookie->isSecure(),           
    //'httponly' => $cookie->getHttponly()       

Even after that, I could not login into admin. It is as it was. Anyone faced this issue? Is there any other solution to this issue?

(I tried clearing cache and session through ftp).

share|improve this question
could you please clear the browser cache/cookie and try again? – alamelu Jul 5 '14 at 18:21
Copy core files to app/code/local/Mage/Core..blahblah for editing so Magento overrides the core file. Also use git for version control, it is a godsend. – Chris K Sep 11 '14 at 20:05
@SHIBHI S, refere this link – Manoj Kumar Oct 18 '14 at 5:02
If you're using Chrome, key F12 > Resources > Cookies > Right-click your domain > Clear. – rybo111 Jun 16 '15 at 15:49

12 Answers 12

up vote 67 down vote accepted

Stop modifying the core code like that — it may temporarily solve an issue, but it may create future issues that will be almost impossible 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.)

share|improve this answer
You can use n98-magerun's sys:check command to find problems with cookie domain and base url. – cmuench Jul 5 '14 at 18:57
@Alan Storm, Thank you for the clear explanation. I solved my issue. In my case, reason of issue is 3rd one. – SIBHI S Jul 12 '14 at 10:45
In my case, there was not enough disk space on the server. So you may want to add this as a possible cause. – Simon Jan 12 '15 at 13:41
@cmuench I run that command and I don't understand results: Invalid Unsecure BaseURL Store: default Wrong hostname configured. Hostname must contain a dot ✖ Invalid Unsecure BaseURL Store: french Wrong hostname configured. Hostname must contain a dot ✖ Invalid Unsecure BaseURL Store: sot_eng Wrong hostname configured. Hostname must contain a dot ✖ Invalid Unsecure BaseURL Store: sot_fra Wrong hostname configured. Hostname must contain a dot ✔ Cookie Domain (secure) of Store: default OK - No domain set All Cookie domain look the same Ok and No domain set – Denisa Feb 13 '15 at 11:02
@Denisa You'll have a bit more luck if you try asking that as a new question. – Alan Storm Feb 13 '15 at 15:08

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

share|improve this answer
Thanks, this really helped me – ryeballar Aug 10 '14 at 10:17
This helped me get my development environment running in Chrome, but remember not to use these settings in production as it opens up a whole class of security vulnerabilities. – Stephen Crosby Oct 19 '14 at 0:50
where is the Session Cookies Management section? – Aryeh Armon Aug 26 '15 at 4:41
Also check your cookie domain - I was developing locally and this turned out to be my issue. – Phil Birnie Nov 10 '15 at 19:18
To set Use HTTP only to No without admin panel access. You can launch directly this SQL query : UPDATE __DATABASE_NAME__.core_config_data SET value = '0' WHERE core_config_data.path = 'web/cookie/cookie_httponly'; – Nolwennig Dec 8 '15 at 9:12

I recently had the same problem and simple trick worked for me. Also this is for people who cannot access the dashboard on Google Chrome. If you can please carry on by working on Mozilla Firefox then please do so because I guess this issue is not persistent on Mozilla firefox.

So the solution for chrome is:

Goto System->Configuration->Web. Expand the Unsecure and Secure tab. Change the Base URL to[Your folder name] if your using localhost or change it to your Site URL through which you are accessing the frontend. I had to login twice to get the Dashboard since when I entered the details for the first time, it just refreshes and comes back to the same page as you mentioned it as looping. Please try and let me know whether it worked for you too.

share|improve this answer
  1. Open your Magento installation directory. Locate and open index.php file.
  2. Search for error_reporting(E_ALL | E_STRICT); code.
  3. Comment it out like that:

    /*error_reporting(E_ALL | E_STRICT);*/

  4. And use the following code instead:



  5. Uncomment it by removing the # sign, so it looks like that:

    ini_set('display_errors', 1);

  6. Save this file and upload to the server. Reload your website page to see errors.

share|improve this answer

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.

share|improve this answer
this works! I don't understand why Magento doesn't write the sessions and cache on files. The permissions are correct! – Michelangelo Jun 6 at 15:09

I had the same problem and I solved it by deleting all files in /var/session . I think it's because too many session in Magento!

share|improve this answer

It’s also important that you have a form key present, otherwise your form won’t get processed.

<?php echo $this->getBlockHtml('formkey'); ?>
share|improve this answer

A simple solution to this problem is to use as you hostname instead of localhost.

Since the problem is that you cannot log in to your admin, you should change the secure and unsecure base urls in the database tabel: core_config_data

This will also have your baseurl validate with n98-magerun's sys:check

share|improve this answer

If you are developing on localhost and have set or changed your domain name to localhost, update your database table core_config_data domain names to instead. E.g. UPDATE core_config_data SET value="" WHERE path="web/unsecure/base_url";

share|improve this answer

Also, you can update the password in the database if everything else from above didn't work and you need desperate access:

UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username=‘user’;

replace user and password words according to your needs.

share|improve this answer

Another possible reason: harddisk/volume/quota is full and so the session data can't be written to disk. May seem unlikely, but just happened the second time to me and took a while to figure out.

I don't have enough reputation to comment, but @Alan Storm, maybe you want to take this in your excellent list.

share|improve this answer

Open your phpmyadmin from your host try once this sql command.
Run this Sql

UPDATE core_store SET store_id = 0 WHERE code='admin';
UPDATE core_store_group SET group_id = 0 WHERE name='Default';
UPDATE core_website SET website_id = 0 WHERE code='admin';
UPDATE customer_group SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';

Now admin can able to login.
please follow this admin page shows 404 page not found

share|improve this answer
don't forget to open in anonymous window or another browser for removing sessions – Martin Jun 7 at 13:15

protected by Community Dec 16 '14 at 13:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.