Drupal 4 site not letting me log in

Author: 
Luke Tarplin

We recently had a problem on a multi site Drupal 4.7.11 installation. The problem was that the site admin tried to log into the site, with the correct details and the site would try to log in, however it would return the admin to the user page. there was no message or explanation for this.

A check of the Sessions table showed that a session had been opened for that login attempt and after examining the cookies stored in the browser (Firefox 3+) i decided a problem with cookies was likely.

I created a file in the site root directory and input the following code: print_r($_COOKIE);

This shows that the multiple domains all have the same Session ID despite the cookies stored in the browser having different Session ID's for the various domains.

I inspected the settings.php file in sites/default and found the cookie configurations. I also noticed a note about the Browser confusing cookies from multi-domain sites.

The answer was right there...given by Drupal itself, but little known. I added .www.domain.tld into the cookie_domain setting and all works well now.

Valid XHTML 1.0 Strict