9

I've searched what feels like hundreds of solutions and implemented them all. I've also searched this website in order to find the same question, but I was unable to locate it.

I have a development site and a production site. To migrate between the two I use github push and pulls. This hasn't been an issue in the past, however, I have run into this problem multiple times. After a file migration Drupal no longer allows me to login. I attempt my login credentials and immediately receive an Access Denied page.

My site cookies are reading and writing no problem. I've located the cookie ID and found it's entry in the database. So the cookies seem to be working fine and the database entries are working somewhat fine.

The problem that I can see is that the database session records are not saving any user ids. When I manually change the user id in the db record to 1, for my IP, and then refresh the website, I'm logged in. Any ideas?

ini_set('session.cookie_domain', 'exampleorg');
ini_set('session.cookie_domain','www.example.org');
ini_set('session.auto_start', 0);
2
  • Just made a little discovery here. My site keeps toggling between HTTPS and HTTP during the login. So I'm wondering if this is throwing off the session. Commented May 25, 2011 at 22:55
  • OMG I FOUND MY PROBLEM. I had setup my virtual host wrong for my SSL. My SSL was pointing at my dev site and not my live site. So the fact that it was redirecting me upon login to ssl meant that I was totally changing websites. that was horrific... took me all day.. Commented May 25, 2011 at 23:04

3 Answers 3

6

I also had the same problem, and it was related to mod_rewrite. I have enabled the mod_rewrite with the following command and the problem was fixed.

sudo a2enmod rewrite
1
  • Sometimes it's the simplest of solutions. Thank you!
    – mcriecken
    Commented Jun 13, 2018 at 18:56
3

FYI, your sites\default\settings.php file should contain a cookie with the same name as the path you are using so if your previous web server had a domain of www.boldlygowherenomanhasgonebefore.com and you moved your drupal to localhost, the cookie domain must reflect that change:

WAS: $cookie_domain = '.boldlygowherenomanhasgonebefore.com';
CHANGE TO: $cookie_domain = '.localhost';

1
  • You won :) This is exactly what I did
    – qasimzee
    Commented Jan 10, 2014 at 6:35
1

Obviously not your solution but for anyone else coming here, I had a similar problem (unable to log in) but mine was a clean URLs issue solved as follows:

There was something going on with clean URLs, they were semi-working which is why I dismissed them as the problem, but it was.

I eventually had to edit the variables table in the DB (changing LONGBLOB to LONGTEXT so I could), switched off the clean URLs flag (set "1" to "0"), clear the caches to remove the cached version of variables.

And then things worked right.

Your Answer

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

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