Help, I can’t login to my Drupal website

Drupal update/upgrade FAQ: Help, I can’t login to my Drupal website after performing a Drupal upgrade!

(Okay, that’s not really a question. But it is a common Drupal problem that might make you panic.)

If you ever happen to upgrade a Drupal website, and then find that after the upgrade you can’t login to your Drupal site, don’t panic, I may have an answer for you.

Background: Can’t log in to Drupal website after upgrade

As I traveled up here to Alaska, I let a lot of Drupal updates pile up, and I got so far behind that I decided to take this Drupal upgrade approach:

  • I copied my production Drupal website to my test server (files and database).
  • I did all the Drupal updates on the test server.
  • When I was satisfied that everything was working, I moved the new Drupal files and database back to the production Drupal website.

After I did this and restarted Apache, everything looked fine just browsing the website, but when I went to log in using any of my Drupal user accounts, the Drupal login process kept silently failing. I looked in all the log files, but there were no error messages. I sat there trying to think, why can’t I log into my Drupal site?

Oh, and one more funny thing: I tend to switch between a lot of different browsers, and I remembered I had logged into my website using Safari, and didn’t log out the last time. Would Safari let me log in? Sure enough, I started Safari, went to my website, and Drupal thought I was logged in.

Can’t login to Drupal website after upgrade - problem solved

The solution to not being able to login to a Drupal website after an update/upgrade seems to have two parts. First, because I moved files between two different servers, I suspected Drupal file permissions were a problem. So I cracked open the original Drupal INSTALL.txt file, and sure enough, I needed to run these commands:

chmod o+w sites/default/files

chmod a-w sites/default/settings.php
chmod a-w sites/default

That was a good start, and I was able to log into my Drupal site from one browser (Chrome) where I had just cleared the browser history and cache, but I couldn’t log into the website using Firefox. I was still seeing the “silent login failure” that I saw earlier. Sure enough, after clearing the cookies for my website, I was then able to login to my Drupal site.

So, seeing this behavior, I think that’s why the problem requires these two steps:

  1. Fix the file permissions of your Drupal installation.
  2. Clear the cookies from your browser for the Drupal website you’re trying to log into.

The website was running

The funny thing was, it wasn’t a “panic” situation for me. My Drupal website was up and running, and I knew it was working fine on my test server, At first I figured I had messed up the database permissions, and I could read from the database but couldn’t write to it. But when changing those permissions didn’t work, I took a break. That’s when I thought about having moved all the files from one server to the other, and the idea that the file permissions were messed up came to mind.

Summary

In summary, if you’re having a problem where you can’t login to your Drupal website, I hope this article helps.

Comments

Permalink

That actually helped. I had the same after upgrading the core from 6.16 to 6.17. Suddenly no-one could log in.

As the site in question is a live site I had to do "emergency rollback" back to previous version to get it working again. I did the upgrade again on the quiet hours with the same results. This time I had decided to find the reason for this behavior.

That's when I stumbled to this post. Clearing the cookies let me access the site again.

Thanks a million for the tip!

Okay, one more weird Drupal login problem I've just run into: If I view a Drupal page like this:

http://www.devdaily.com/linux/vi-vim-editor-color-scheme-syntax

Drupal recognizes me as being logged in to my Drupal website, but if I go to the exact same URL, but leave off the "www", like this:

http://devdaily.com/linux/vi-vim-editor-color-scheme-syntax

Drupal doesn't recognize me as being a logged in user.

When I look at my browser cookies, I see cookies there for both devdaily.com and www.devdaily.com, but without some more digging, I don't know why Drupal doesn't see me as being a logged in user.

The urls devdaily.com and www.devdaily.com can indeed be configured to point to totally different sites. I'm quessing that's why the cookie behavior makes a distinction between using and not using the www prefix.

It can, in fact, cause a lot of other weird things as well.