2

I'm migrating a client's site to a different server because we're changing web hosts. The domain name still points to the old site for now and I either use an ip address or a temporary url to preview the new site. However, since I moved it, I can no longer log in, I get an "access denied" error message. Is this a known issue? How can I resolve it?

EDIT: I oddly don't have this problem when I download the site to my hard drive and run it locally.

2
  • 1
    Did you clear out the sessions table and all of the cache tables? Also, are you 100% positive that you are pointing to the correct database in settings.php?
    – mpdonadio
    May 4, 2012 at 13:26
  • 1
    I had this problem and running this in mysql: repair table sessions; resolved the issue. Mar 7, 2013 at 17:53

1 Answer 1

3

This happened to me so many times back in the days of Drupal 6.

99% of the time it was caused by the anonymous user record having been removed from the users table in the database.

Try adding a user to that table with a uid of 0 (and all other fields empty); if the above is what's causing the problem, that should fix it.

5
  • Thank you for your reply, Clive, but there already is such a user in the table... any other ideas? Thanks!
    – Jane
    May 4, 2012 at 10:00
  • 4
    Try looking in sites/default/settings.php at the $cookie_domain variable...does it match the new site's URL?
    – Clive
    May 4, 2012 at 10:01
  • No but it's commented out... so I'm wondering if it would have any bearing. Also I tried playing around with it earlier on. to no avail unfortunately.
    – Jane
    May 4, 2012 at 10:13
  • Hmm that's odd, especially since you mention the same codebase works on your local machine. I would guess that narrows it down to server configuration. Do you know if PHP sessions are enabled on the remote server?
    – Clive
    May 4, 2012 at 11:08
  • Clive's $cookie_domain fix is the one I most often encounter, statistically speaking. May 24, 2013 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.