Login issues and $cookie_domain

Posted Dec 29, 2009 // 0 comments
Tirdad:

This issue occasionally comes up when creating development instances of existing sites or during migrations, and since it's quite annoying yet painfully simple to solve, it's a nice little tip to share.

When migrating pre-existing Drupal sites from one environment to another, you may find yourself unable to log in, be it as the root admin (uid 1) or a generic user. You check the database, it's all there. So are the users, and the site shows up fine content-wise. Resetting your password ultimately brings you back to square one. What now?

Check if $cookie_domain didn't happen to be set in settings.php. This variable is not necessary unless you're working with multiple domains for the same site and would like to share a session cookie between them. In most cases where it was set, the old value (let's say yourolddomain.com) won't match your new environment's domain and that's why you won't be able to log into the site on yournewdomain.com. Commenting it out or updating it depending on your situation will fix the problem.

About Tirdad

Tirdad Chaharlengi is a software developer with experience in an eclectic selection of environments, ranging from a computer game company, Nevrax to the Internet division of TF1, France's leading private television channel.

Tirdad ...

more >

Read Tirdad's Blog

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <strong> <code> <p> <img> <ul> <ol> <li> <h2> <h3> <h4> <b> <u> <i>
  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.