On one of my websites, I had this weird issue one day suddenly . Both users and admin was not able to login to website. It was going into redirect Loop and it used to display page not found "404" or it used to just be on the login page. I read in forums on drupal.org and several other pages. There were many solutions proposed, which were actually quite confusing and not convincing I had not changed anything on my website to cause this issue, they why suddenly no-one is able to login.
The fix came from one of the comments "All I HAD TO DO WAS REPAIR THE "sessions" table" in my phpmyadmin.
repair table sessions
This table was getting locked out due to some looping activity. I did have persistent login module on my website, which I disabled. Once I executed this repair statement in my database, users were able to login just fine.
Another instance when I had this issue was when I migrated from Drupal 6 to Drupal 7. After doing some updates, I was not able to login to drupal tried every possible option. The issue was some of the updates for contributed modules did not complete.
Run update.php again if you are in this situation. Remove the contributed modules for which it throws error.
Following did not work
- http://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-upgradesuggests 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: