1
votes

After migration I can't log in to the admin panel. After i enter the username and password, the same page reloads. I have tried:

Can't log in to Magento Admin

Magento: Can't log into admin [duplicate]

Magento admin login not working

Magento can't login in admin with right username and password

But nothing works I have tried to comment out the code lines in

app/code/core/Mage/Core/Model/Session/Abstract/Varien.php.

and nothing!

And I changed the core_config_data web/unsecure/base_url and web/secure/base_url.

I am running out of ideas, Thank you for any help!

EDIT:

I checked the cookies on the old server, and when on the login page i get an adminhtml cookie, but not on the new i get an hz_amChecked cookie.

EDIT 2:

The new server is on siteground, maybe something I am missing on the settings there I tried to put a die() in app/code/core/Mage/Core/Model/Session/Abstract/Varien.php but nothing happens.

6
Did you check to make sure the new server meets magento minimum system requirement and all folder have the correct permission? Did you clear your var/cache?Renon Stewart
I cleared my var/cache and installed a clean version of magento and it worked, then i changed the database of the new magento installation with the old database and the same problem poped out, so the problem is somewhere in the database, i suposeMarko
Did you make any changes to <crypt> in /app/etc/local.xmlRenon Stewart
Haven't made any changes to the <crypt> in app/etc/local.xmlMarko

6 Answers

4
votes

I found the problem, it was in the /app/etc/local.xml in:

<install>
   <date><![CDATA[Day, dd Mth yyyy HH:mm:ss +0000]]></date>
</install>

I didn't think that the time of the installation was important, but i changed the +0000 to the same value as the new magento installation had and

<session_save><![CDATA[file]]></session_save>

to

<session_save><![CDATA[db]]></session_save>

cleared the files var/cache, var/session and removed all cookies from my site in the browser and it worked! Finally i can rest a little :) Thank you all anyway for the help!

1
votes

I had the same issue- These steps fixed my problem

1) Clear or delete /var/cache/* and /var/session/* folder all files
2) Clear your browser cache/cookies

If that doesn't work make sure session and cache directories are writable

optional if still not work then try this query In PHPMyADMIN run this query:

SET FOREIGN_KEY_CHECKS=0; 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'; SET FOREIGN_KEY_CHECKS=1;

1
votes

What I did in this matter is I created a new Admin account I thought that I forgot the password of the admin panel.

To create a new admin user, just copy and paste the command with your values in it.

php bin/magento admin:user:create --admin-user="username" --admin-password="password" --admin-email="[email protected]" --admin-firstname="admin_first_name" --admin-lastname="Admin_last_name"
0
votes

You can try by changing core_cofig_data value field for path web/secure/base_url from non secure URL to secure URL like please change it from http://example.com/ to https://example.com/ . It had solved my admin login problem when i migrated one of my magento website.

0
votes

Reason of the problem

Do you know why this problem occurs? The problem occurs because magneto could not store cookies. We run it as localhost and localhost is not true domain but to store cookies we need a domain. That’s why login stops without saying any word.

Solution: Go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.

Find the code:

session_set_cookie_params(
  $this->getCookie()->getLifetime(),
  $this->getCookie()->getPath(),
  $this->getCookie()->getDomain(),
  $this->getCookie()->isSecure(),
  $this->getCookie()->getHttponly()
);

and replace with

session_set_cookie_params(
  $this->getCookie()->getLifetime(),
  $this->getCookie()->getPath()
  //$this->getCookie()->getDomain(),
  //$this->getCookie()->isSecure(),
  //$this->getCookie()->getHttponly()
  );
0
votes

In your php.ini enable max_input_vars and increase the value for your server

;How many GET/POST/COOKIE input variables may be accepted
;max_input_vars = 1000
max_input_vars = 35000