Friday, August 6, 2010

Drupal Login Silently Fails

Just a quick note on a fix if you happen to be experiencing a problem logging into a Drupal site.

The behavior is the login seems to silently fail.  No error message, no log messages, nothing.  Login/password is accepted (and bad passwords will fail - so it is hitting the db properly), but after submitting you are returned to the front page not logged in.

I solved the issue by checking the cookie_domain setting in the settings.php file.  The domain name is parsed from the $_SERVER['HPPT_HOST'] php variable using some regex.  If this is done incorrectly, the wrong domain will be set in the php session.cookie_domain variable which will prevent logins.  To fix, you can hard set the $domain variable in the settings.php file.  There are notes on this in the settings.php file, but it is a little obscure.

1 comment:

  1. Thanks. Your note about it being a little obscure in settings.php really helped un-obscure things.

    ReplyDelete