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.