I cannot log into after migration 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?


https://stackoverflow.com/questions/2846935/cannot-login-to-drupal-in-chrome-or-firefox-but-safari-works suggests that I update $cookie_domain in the settings.php file. I've tried every configuration and it has not helped.
http://www.go2linux.org/cannot-login-into-drupal-table-corrupted also suggest that I repair the sessions table. I've done that, cleared the sessions from the db and cleared my cookies. It did not work.
http://www.madebymorgan.com/blog/2010/07/15/cant-login-after-drupal-617-upgrade suggests that I update the values in my settings.php file: $cookie_domain and $base_url. I've tried every combination and was unsuccessful.
I've read the install.txt which says to run the following commands for proper permission and ownership levels: chmod o+w sites/default/settings.php, chmod o+w sites/default, chmod o+w sites/default/files, chmod a-w sites/default/settings.php, chmod a-w sites/default.  It didn't work.
The patch in http://drupal.org/node/56357#comment-236726 adds some code to your sessions file. I've done this and it didn't work.
On http://drupal.org/node/56357#comment-391535, markus_petrux had a good suggestion by defining the PHPSESSID with a new name as well as setting the cookie domain and path manually. It didn't work.
http://old.nabble.com/Re%3A-Can%27t-login-p22258960.html suggests adding register_shutdown_function('session_write_close'); at the end of settings.php works, which also didn't work for me.
http://drupal.org/node/6696#comment-204863 tells us to add some ini settings into settings.php, clear the cache, clear cookies, clear privacy, restart Firefox, and add to settings.php the following lines:




ini_set('session.cookie_domain', 'exampleorg');
ini_set('session.cookie_domain','www.example.org');
ini_set('session.auto_start', 0);
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