Site visitors seeing your ugly error messages on the screen (along with details of your Drupal installation path)? Once your site goes from dev to launch, you probably want to have errors recorded in the log but not splashed across the screen. Head to the handy Error Reporting settings found at admin/settings/error-reporting.
How to fix "Access Denied" for admins?
Yikes! A client's site suddenly turned up "Access Denied" for admins – up, down, and all around. Attempts to log in as almighty User ID 1 would simply spit the login screen right back again, or appear to "take" momentarily, yet return "Access Denied" for any following admin action.
Some horrible flub-up with user permissions? Can't even check and troubleshoot when the site won't let the admin in! And playing with cache, cookies, and other browser fiddly bits wasn't doing the job.
I expected major pain to result. But a search of the Drupal site quickly turned up this gem:
http://drupal.org/node/6696#comment-198054
Just a little addition to my INDEX.PHP file. I tried it, and Huzzah! Back in logged-in action.
The cause of the problem? Perhaps this:
http://drupal.org/node/6696#comment-204960
Hmm, could it be that the ISP had updated PHP from 4 to 5? Yes, it seemed so! (Maybe now I'll start to pay attention to their newsletters.)
So the thread addressed my woe, and I'm a happy Drupaller all over again. Now, this particular case had a Drupal 4.x site knocked out of action by a PHP upgrade, so it may not apply directly to many users' situations. But if you're getting "Access Denied" hate (on 4.x or 5.x), give the linked thread a peek.
My thanks to everyone offering help on the topic, especially Drupal Gods kweisblatt and johnchalekson!
Relevant Content
The Drupal Ace logo has dealt these content suggestions from the deck.
Learn Drupal, hands-on
Get the beginner-friendly ebook that teaches community site building via a live case study.







It worked
adding $GLOBALS['tempUser'] = $user; worked but I find it worth noting that I had to delete cookies first
Same problem
I have the same problem. Did you find any solution?
Thanks,
Homa
Yes, a fix
If I recall correctly: Per the link in the article, adding
to the end of the index.php file did the trick. That was Drupal 5.x for me, though, long ago, and concurrent with an upgrade from PHP 4 to 5 by my webhost. So it may be a useful fix for you, if you happen to be under those same conditions.
Re: How to fix "Access Denied" for admins?
Didn't do it for me.
I can log in as user 1, but gets access denied to all the admin-stuff..
Re: How to fix "Access Denied" for admins?
Ack, that kind of thing is frustrating as heck. I imagine there are many, many little ways that an installation can get screwed up and deny access.
The best immediate step you can take is to throughtly search the Drupal.org forums for more possibilities, and beg for help if nothing good turns up. All of which you've probably already done... : (
Re: How to fix "Access Denied" for admins?
Thank you! My ISP just upgraded their default PHP installation to 5 on 1-1-08. Thank you for sharing this.
Post new comment