Share and save

Share/Save

Random piece of content

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.

Question answer: 

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!

Share/Save
Homa's picture

Same problem

I have the same problem. Did you find any solution?

 

Thanks,

Homa

Drupalace's picture

Yes, a fix

If I recall correctly: Per the link in the article, adding 

drupal_page_footer();
$GLOBALS['tempUser'] = $user;

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. 

 

Geir's picture

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..

Drupalace's picture

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... : (

Unknown Drupaloid's picture

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

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><br><p>
  • You may quote other posts using [quote] tags.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options


Drupal power!

Powered by Drupal, an open source content management system

Drupal mini tip

Don't give a theme and a node the same name. Conflicts can occur.