0

We had a Drupal 7 site running on PHP 5.6. We have moved this site to another server running on PHP 7.4.

When I navigate to /user/login, type my username and password, and click on Submit, I'm redirected to /users/myusername, but it says Access Denied and it doesn't show the top bar to change configuration, content, etc. I had also checked the sessions table and it stores the new session with the user ID.

screenshot

No session ID has been stored in cookies after I log in.

screenshot

I had tried so many ways, but nothing helped me.

  1. I checked that mod_rewrite is enabled
  2. I tried with and without Base URL setting in the settings.php file
  3. I tried with and without RewriteBase setting in the .htaccess file
  4. I tried with and without cookie_domain setting in the settings.php file

I am surprised that, when I tried to migrate another website to the same server with another sub-directory, the login worked fine.

They are Drupal 7 sites migrated to the same server but on different sub-directories.

Why doesn't the login work in one of the sites?

1 Answer 1

1

After a lot of debug I found the issue in settings.php file

ini_set('session.cookie_secure', 1);

for HTTPS site the session cookie must be secure but as the current site is HTTP, so we need to turn off this feature by

ini_set('session.cookie_secure', 0);

Now, login is working fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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