Hello!

I installed Drupal 4.5.2. I have done everything, i created the first user succesfully.
But whenever I log on or even just go to the home page it gives me a page that says "Access denied",
"you are not authorized to access this page".

I've checked everything I can think of...

I have read all threads, but i haven't found the correct solution for this problem..

Thank you for Your help!

RedHat Linux, Apache 2.0.51, MySql 3.23.58, PHP 4.3.10

Comments

tobyspark’s picture

I am getting this too. Am very confused as I have set up various test drupal sites (4.6.3) before successfully - now for the real deal (4.6.6) and I've fallen at the first hurdle.

The fresh drupal installation is creating the first and subsequent accounts, emailing me their details, rejecting false log-ins, but if the correct log-in details are used all you get is the access denied content page and no change to the log-in block.

I have tried standard troubleshooting - fresh install, fresh database, searched server logs. For what its worth, I started then aborted the process in the https space, and am on a Plesk 7.5.4 virtual host. I didn't have these problems before on the same physical server but with an earlier

Any ideas most appreciated. I didn't anticipate this, and my two days allocated to set it up are now crumbling away... grrr!

Toby

joe_t’s picture

Drupal 4.6.6
Windows 2000 server
IIS 5
PHP 4.4.0
MySQL 4.0.26

Install went fine. Created the first user, which was added to MySQL, and I got an email with the password. But when I try to login with it I get "Access denied. You are not authorized to access this page."

I permitted all drupal directories and subdirectories "Full control" to the web user (IUSR_WWW). The MySQL user I created for drupal has "ALL PRIVILEGES."

Any help would be appreciated.

Thanks,
Joe

Geotechy’s picture

I am not an expert in Drupal's core programs, rather a dummy, and I still tried to post my solutions to such a persistent problem with Drupal 4.7.x CMS and it was listed under the following thread.

http://drupal.org/node/92100

It works in my case, and it might work in your case too. Try it. If you are using multiple domains to point to the same domain, and if you try to access an administrator / a registered user account with multiple domains, this kind of problem is a regular one (chronic?). I learned to live with it. A better way to avoid "ACCESS DENIED" or "logged in but you are not really allowed to have access as a registered user" problems is to be consistent with the same domain/ URL. The problem is visible when you use two settings.php to point to the same database-based domains. It would be better not to share the same dB e.g. MySQL. Its not only the problem at Drupal CMS, it is also a problem with Joomla CMS. At this moment, 2nd or other domains can be reserved for only visitors use, and it would better not to use multiple domains to access contents as an administrator or a registered user. There seems to be something wrong with CACHE/COOKIE/TEMP files, and its all based on my personal experiences. I might be wrong. Someone can enlighten me.

Learning is a never ending process. As I learn more and more about Drupal or Joomla CMS, entropy of my knowledge on these CMS also increases.

GyaNeX
P.S. Someone should be working on Drupal to turn it also as a CMS for handheld mobile equipments.

Geotechy’s picture

Eureka!

The 'Access Denied' message even after you login correctly is a consistent problem at Drupal 4.7.x and 5.x.x. In the previous posting above, I have already given a dumb solution to an 'Access Denied' problem that you might face immediately after you create a new user account.

Today, I have a good news to some of you who are facing similar message 'Access Denied' when you try to do something at Drupal CMS and suddenly you see 'Access Denied' message, or when you go somewhere while in login mode for a short time (a few minutes to hours) and return to your computer, then you try to do something (whether as a user or as an admin), suddenly you find that the website does not let you work as the registered user (i.e. as 'log in' mode). In my case, it often happens (my finding) because multiple websites (multiple domain names) are pointed to the same copy of Drupal CMS or database (I don't know because of which one).

For example, if I am logged in to my website (e.g. http://www.geotechnical.org/ ) as 'administrator', and if I close Internet Explorer's current session, and come back later as a new session or in the same session (but after some time of inactivity), and try to click on a url at the same database based website via another domain name e.g. http://www.Geotech.Info/ , then my computer will show 'Access Denied' message. In the same way, after closing the session if I try to comeback to my website using second domain name, (while my log in session from first website is still alive/active), then it will ask me to log in to the website: second domain name based log in page. Here is a problem. IF I log in, it may show 'Access Denied' message, and I can not go back to previous domain based pages: access is denied via both websites. Even before logging in to the second domain, if you try to return to your primary domain to do something as a registered user, then you will face this kind of problem. This is what I noticed today. Then, instead of logging into second one, I tried to log in to first one, and it worked very well.

So, one of the solution that I found in my case of multiple domain is that the CMS via cookie / IE session, allows only the very first URL related domain in each session to get access to your website. Second one and on wards will not be allowed to access, even if you log out from the first one. I am not sure but it is the thing that happens around me.

Well, in my other computers connecting internet via LAN cable or dial up connection, this problem does not exist. Why? Don't ask me. Even if I use multiple domains randomly it has no problem. But, in WiFi based computer (my newest computer ? it has CA firewall, and is it a problem maker?), this is a problem that I always face (I am not sure whether the root cause is: WiFi, or FireWall, or computer maker or Windows version or IE set up or TCP/IP set up ?). Whenever I faced such problem, I could not log in for several hours, and my freetime is sometime completely ruined when I want to do something on my website. I hope today's findings will end my frustrations corresponding to this particular problem. Anyway, try using only one (the first one in each new session) domain name instead of using multiple domains. If not, remember which one is the first domain that you clicked when you started the current IE session. Try to go back to the first domain (among your domains) in current session.

Good Luck. If this method works, please post it here for other's benefit.

Thanks.
Dr. G. Pokharel
WebMaster
http://www.geotechnical.org/
"We have been working on Soil Mechanics and Geotechnical Engineering".

Geotechy’s picture

Immediately after I posted above post, I returned to my website via second domain, and I got access denied message to both domain based URLs. Then, I identified (from my fading memory), and logged in to my website without going through hit and trial, it worked. So, if the problem happens in your multiple domain based website, then this solution might work (it does not matter whether you have single copy of Drupal CMs or multiple, because in my recent problem it happened with two domains connected to two separate copies of Drupal CMS, and these two copies have separte MySQL database account. I am not sure it might be because of unique IP address of my website hosting server, and the conflicting information in these two domain related cookies saved on my local computer here. It is all my layman (if elseif else like in 3 blind men's experience on a giant elephant) kind of guesses.

Dr. G. Pokharel
WebMaster
http://www.geotechnical.org/
"We have been working on Soil Mechanics and Geotechnical Engineering".

shabanbi’s picture

I got same problem in my site ,that shows every page admin,user login page shows access denide

how to solve this one plz give me solution

Michael M’s picture

Even though I don't have this problem, maybe you played with the node access rights.

Did anyone disable 'access content' from www.example.com/?q=admin/access ?

Do you get the access denied message even when you are logged in as admin?

----
http://LandCondos.com

tobyspark’s picture

If only I could get that far. Any log-in bounces me to access denied, but the authentication is working ok, see above. So I am stuck in the install process...

I am giving up for now, unless anybody has any ideas. I have tried using 4.7.0-beta6, checked the mysql tables (yes users are being added), recreated the sites and dbs more than I can remember.

The only thing I can't do is grant all privs to the mysql user as per plesk specific instructions at http://drupal.org/comment/reply/47993#comment but that is a red herring I think - read the comment there.

Toby

cmoimartin’s picture

I try to install it on
RHES3 with
xampp (mysql 5 -- php4 or 5 -- apache2 )

and on another server RHES3 with
apache 2
mysql 3.23.58
php 4.3

Still the same problem, i've been able to create the first admin user but can't get in ? Access Denied -- You are not authorized to access this page.
I try changeing the password as well and nothing better.

Martin

SocialNicheGuru’s picture

OK. thanks this worked for me.

Am I to understand that

"access content" under node module supersedes all other access?
I did not have this checked but had "access pages" and "access views" checked under panels. I kept getting the "access deined" message.

I thought that if I had "access pages" and "access views" checked under panels, then that meant that the user with the corresponding role would have access to the panels. That is wrong.

Thanks Chris

http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.

VM’s picture

The answer to your question is yes. To view content one must have the view content permissions regardless of what seperate permissions are set on any one content type.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

Harry Slaughter’s picture

try:

INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);

will either return 'duplicate entry' warning (which is OK) **or** fix your problem.

--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal

--
Devbee - http://devbee.net/

FixB’s picture

I have exactly the same problem.
I installed drupal on a free host provider space, and it worked smoothly.
I tried to install it locally on my computer ang got this access denied just after the creation of the first user.
The mysql installation works correctly (mysql returns a message indicating that the sql operations was successful), and every table seems to be there.
I tried to execute the sql statements above (one by one) and each one produced a 'duplicate entry' , so it seems the table are there and well feed... But the problem is also still there.
I tried t reinstall all twice to the same result...
If anyone has any idea worth sharing, thanks in advance for your answer !

max256’s picture

кто то может на русском обяснить что нужно исправить чтоб заработало?
заранье спасибо.

FixB’s picture

Sorry, I didn't quite get this one :(

FixB’s picture

Ok, the problem is solved for me : I was working with the 'mysqli' module instead of 'mysql'... I switched back to 'mysql' : it's working fine now !

maybourne’s picture

That worked thanks!

spyderpie’s picture

I did this after a suggestion on this post: http://drupal.org/node/97020.

I upgraded from 4.7.4 to 4.7.6 and all users except admin users were not able to view the content. Applying your fix to the database works. But I am confused.

I checked those tables before the upgrade and those entries (the second and third) are not there. The first one is - in the users table.

After the upgrade, the entries are still not there -except for the first.

So to me this says that those entries in the database did not change ... but are needed after the upgrade. I was wondering what access rights I just gave by executing:
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
after the upgrade, and why, if needed and if you know, does the upgrade not apply that change.

Thanks in advance,
Julie

Eagle1-1’s picture

This worked for me, but I am not sure why I needed it. This was a new 5.1 install, not an upgrade.

Eddie L. Seelke
http://www.seelke.net

P.Manish’s picture

I opened my drupal site but I could not view any page.When I open a page then "Access Denied" page is displayed which says "You are not authorized to access this page".In addition I could not even view the admin login page.when I login as admin then the same thing happens.I have executed the queries
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
1st query is executed and 2nd query is giving duplicate result.So my problem is not solved.Plz help me out

jayboodhun’s picture

I was getting a blank page after login and also could not access admin pages
I ran this sql and it fixed my problem.

Many thanks
Jay

kadj’s picture

Hi

I have tried to install drupal 5.6. The installation works fine but once I create the super admin user and change the password or log out I can't seem to ever log back in again with the super user. I tried your sql script above had success with middle users_roles script but this did not fix the probelems of my user not being able to login again. it just seems the the whole session is lost or something???

I have searched the forum loads, no one has said anything of how to handle this problem etc. I have installed my drupal in a sub directory of my site not sure if this makes a difference ..... can any one help ?

host with host excellence windows xp IIS 5, mysql 4.1.***

Napzilla’s picture

I was having the same problem on 6.2, and this fix solved the problem. Thank you for posting the solution!

--Brian

Temi Solo Dio
Brian M. Napoletano
brian@napoletano.net

mjlongo’s picture

I'm installing Drupal 5.23 on a Windoze based computer; I loaded my 5.1 database on it and had the same problem. I inserted these lines and everything is working!!!

shabanbi’s picture

My admin and user login it shows access denied ,not authorized plz give me solutio

weerora’s picture

Access denied - You are not authorized to access this page.
To solve this problem you have to edit database using SQL command:

GRANT ALL PRIVILEGES ON databasename.* TO username@localhost IDENTIFIED BY 'password';

where

* 'databasename' is the name of your database
* 'username@localhost' is the username of your MySQL account
* 'password' is the password required for that username

-------------------------------------------------------------------------
If problem is still exist , You have to try editing file "settings.php" (Drupal\sites\default\settings.php)
at the line
$db_url = 'mysql://username:password@localhost/databasename';
change mysql to mysqli
$db_url = 'mysqli://username:password@localhost/databasename';

Before using mysqli, make sure you have the line 'extension=php_mysqli.dll' in file "php.ini"
and you should have files "php_mysqli.dll" and "libmysqli.dll" in php directory.

Stop and start web server before take effect.

Harry Slaughter’s picture

the 'access denied' message in question here pertains to drupal access permissions. The solution you're suggesting relates to a problem with the site being able to connect to the database, in which case, all users would see a drupal error page, not an access denied page.

if you're seeing 'access denied' for a specific node, you *are* connecting to mysql, and that's not your problem.

--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal

--
Devbee - http://devbee.net/

gleble’s picture

I seem to have the same problem plus an added error message. Details below
Has anyone solved this yet? Help

I am on the welcome page and am trying to create an administrator account but it says access denied. This is the first time I have been here. If I go to the administer page it tells me the most recent system events, which are:

user warning: Can't create/write to file 'C:\Program Files\xampp\tmp\#sql_14c_0.MYI' (Errcode: 2) query: SELECT w.*, u.name, u.uid FROM watchdog w INNER JOIN users u ON w.uid = u.uid ORDER BY w.wid DESC LIMIT 0, 50 in C:\Program Files\xampp\xampp\htdocs\example\drupal-4.7.4.tar\drupal-4.7.4\includes\database.mysql.inc on line 121.

I think it is a problem with my settings.php file. Most probaly with the line

$db_url = 'mysql://root:@localhost/drupal';

I am pretty sure this is wrong but it is the only thing that will get me into drupal with no errors.
My user name is 'root', there is no password(initial settings) and my server is 'Localhost'

I am using drupal 4.7.4 , PHP 5.1.6 , MySQL 5.0.24a , Apache 2.23 and Xampp Windows version 1.5.4a

What should I have in settings.php?

Michael M’s picture

It seems like your mysql database is not setup properly. For test environments on Windows, try http://wampserver.com/en/index.php

Easy for beginners :)
----
http://eUploads.com

gleble’s picture

I can access my database with PHP so why can't drupal?

ebernabei’s picture

Not saying this is a bug, but just pointing out a key reason... don't know what causes it yet.

The sessions table has two rows in it when you first create the new user. One has UID = 0 (the anonymous users hitting the site) and the second has UID = 1 (the super user first created).

Well, Drupal is updating the UID of superuser from 1 to zero upon button click events.

Then, the permissions subsystem says "hey, you are anonymous... you can't go there".

The question is ...why is Drupal changing this one UID value when setting PHP session information right after logging in for the first time?

I'm still hunting....

Emilio

verbal’s picture

I'm having the same problem ebernabei, here is what i've hunted down so far:

http://drupal.org/node/99782

lanexa’s picture

Did anyone find a fix for this? I'm running 5.1 and this issue just presented itself on a site less than 1 month old. Thanks,
cc

ebernabei’s picture

I posted farther below about why this is happening... but I was chasing my tail... "forest for the trees" syndrome :-)

The solution suggested about using the mysql vs. mysqli DLL's is bang on! 100% correct!

Why is a database driver for PHP causing permission problems in Drupal? The SQL being run against MySQL is causing the $user->uid (the unique ID assigned to the very first user) to be reset to zero or NULL when a read is done. Then, when the sessions table is updated a bit later in the code, the correct uid in the table (that would be "1") is overwritten with zero -- ehhh -- that would be the same uid as anonymous !! Ouch.

So then when you click anywhere, your browser sends the session context to Drupal. Drupal reads it from the corrupt sessions table and sees that you seem to be uid = 0. So in the Drupal code it takes a nasty turn for code meant to keep pesky anonymous users out.

So what I did is:
- switch from mysql _TO_ mysqli.dll by copying the new DLL from \php\ext to \php (make sure \php is in your PATH for Windows)
- modifying the php.ini
- modifying the settings.php config file

-Emilio

PS: Windows XP Pro, Drupal 4.7.4, MySQL 5.0, PHP 5.2.0RC6, Apache 2.2

NickT-1’s picture

I think the problem is that the mysqli (as opposed to the mysql) is for versions of mysql >= 4.1. There must have been some significant change in this version. In the PHP installer you can change and add "MySqli" (and make sure you change the path as above). I don't think you have to change the privileges, I think the problem is MySql with versions >= 4.1. I have version 5.0 of MySql installed and you have to change sql-mode to (i.e. search in the my.ini in MySql):

sql-mode="MYSQL40"

To make it backwards compatible with 4.0 (note not 5.0 to 4.1, which is also incompatible).

Thanks for the help you guys.

macm’s picture

I dont understand

May you explain again?

After reinstall wampserver I start receive "Access denied" messages.

What is (make sure \php is in your PATH for Windows)?
- modifying the php.ini AND ADD OR UNCOMMENT WHAT?
- modifying the settings.php config file AND ADD OR UNCOMMENT WHAT?

Step by step

spydmobile’s picture

Wow. I have tried everything! On my local computer running 474 and 5b2 side by side, I would get the login issue every time in 474. I tried the patch fix, and could not apply it, tried the sql fixes but they were unsuccessful. I tried the mysqli switch and it worked.

Sooo, I can turn the problem on and off by switching back and forth in my settings file from mysqli to mysql. Would anyone like me to try anything specific? It would appear that the person who said it could not be a database access problem, was not quite right. This appears to be a problem with many red herrings or it is multiple porblems showing same symptoms.

I am Running:
474 on WAMP5 (v1.6.6) on my local laptop.

Wamp 5 has:

Apache/2.0.59 (Win32)

PHP version :
5.2.0

Loaded extensions :
bcmath, calendar, com_dotnet, ctype, session, filter, ftp, hash, iconv, json, odbc, pcre, Reflection, date, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter, apache2handler, mbstring, gd, mysql, mysqli, PDO, pdo_sqlite, SQLite

MySQL version :
5.0.27-community-nt

hayles’s picture

I renamed it and is still having the same problem

ladycentaur’s picture

Drupal packages tend to have the config.php file permissions set to unwriteable. When you register your admin account you need the config.php to be writeable. Just chmod it to 777 for the install and first account set up and then chmod it back to what it was afterwards.

It's most likely that you are being denied access because your config.php file won't let your main admin info be saved.

macm’s picture

Could be but I am using my localhost windows XP Pro

I had install last wampserver WAMP5 1.6.6 : with PHP 5.2.0 and start the problems so I uninstalled
and back to
WAMP5 1.6.5 : with PHP 5.1.6

I dont know why but wampserver WAMP5 1.6.6 : with PHP 5.2.0 doesnt work with drupal at this moment.

Just examplain to my error after login in my localhost if I tried click in somehing I received "Access denied"

But now is ok

_dynamic’s picture

Config.php - is that a file in the Drupal package? Where can I find it? I only find it in my XAMPP package. Thanks for reply.

khedaywi’s picture

Mac OS X 10.4.8
PHP 5.2.0
MySQL 4.1.21
Apache 1.3.33

At first I tried installing Drupal 4.7 and Drupal 5.0 Beta, with the database connection settings as 'sql' and not 'sqli'

Everything was going good, Drupal was connecting to the database with both versions and it created the appropriate admin account. But as soon as I tried to change the password, or clicked the 'submit' button it would immediately go to a "YOU ARE NOT AUTHORIZED TO VIEW THIS PAGE." error.
I could click on the menu link (one at a time) and would have to enter in the username and password, but the password was the one that drupal initially assigned, NOT THE ONE THAT I HAD CREATED.

Resolutions:
For Drupal 4.7:
When you have to go into the settings.php file to put in the username, password, and database, change the 'sql' to 'sqli' . Before doing this I started out with a completely new database. It worked like a charm.

For Drupal 5:
When it asked for the type of database choose 'sqli'. Works perfectly now.

Not sure why this fixed it but it works now.

verbal@drupal.org’s picture

the sql to sqli thing didn't work for me, but the session.inc was right on target.

I went to cvs:

http://cvs.drupal.org/viewcvs/drupal/drupal/includes/session.inc?view=ma...

downloaded that session.inc over the current includes/sessions.inc file and everything started working again, now I am just getting an error in the Status Report about GD library for PHP is missing, but thats an unrelated problem and drupal is nice enough to even give me a link to the download of the GD library, so I just need to install that real quick and everything will be great.

yennersnow’s picture

Getting a recent session.inc file worked for me, too. I didn't have to use the mysqli trick.

drupal 4.7.4
windows XP
XAMPP 1.5.5
php 5.2.0

gtaylor’s picture

I know this thread is ancient. But I wanted to post a little info in case somebody else has the same problem.

One of my sites is very conservative - no public posting and they're happy. So, I've left them on Drupal 4.7.

Recently site5 did some system upgrades. Likely that caused this site that was working to stop working for authenticated users. It was fine for all the guests. But if you tried to login, one click and "Access Denied"

I won't list out all the steps I tried that didn't work. After a lot of trial and error it looked like my UID in the sessions table was getting set to 0 as described above. I took a 4.11 sessions.inc file and used it to overwrite my 4.7 sessions.inc file.

I can now login and do things just fine. I may now invest a little time to upgrade this client though - the rest of the world is not going to stand still...

THANKS

MediaFormat’s picture

this did the trick for me too.
what a lifesaver!

hunthunthunt’s picture

Thanks khedaywi,

Had the same problem myself - as you suggested, changing 'sq'l to 'sqli' fixed this frustrating problem.

XAMPP for Mac OS X 0.6a
MySQL client version: 5.0.27
PHP Version 5.2.0
Apache/2.2.3
OSX 10.4.7

regards,

hunthunthunt

kreynen’s picture

I have the same software with the exception of running this on Intel XServe running OSXS. I installed updated versions of PHP and MySQL and moved a functioning Drupal install from a G5 server.

Switching to sqli just breaks the MySQL connection.

quasarchangel’s picture

warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/style.css) is not within the allowed path(s): (/home:/tmp) in /home/quasar/includes/theme.inc on line 64.
warning: Cannot modify header information - headers already sent by (output started at /home/quasar/includes/common.inc:348) in /home/quasar/includes/common.inc on line 190.

Thats the message I get with the Access Denied thing. I have not even been able to login, so this is still while installing Drupal, and I'm installing on a free hosting site. Anyone know what I can do to fix it?

swifty’s picture

Mine's not an install problem as I have 2 sites running 4.7.4 that have been installed for several months. It is only just now that I am seeing "Access Denied" messages when logging in. Only for authenticated users. And these are FreeBSD boxes.

The web host says there have been no changes so it is very bizarre. I am guessing at a config change on their web server. Would I be right?

**UPDATE**
Found the solution. My webhost had done a PHP upgrade to 5.2.0 which highlighted a Drupal bug. The answer was to modify session.inc and add one line. See http://cvs.drupal.org/viewcvs/drupal/drupal/includes/session.inc?rev=1.2...
and all I had to do was insert the line register_shutdown_function('session_write_close'); into session.inc

saltspringer’s picture

I'm in a similar situation; suddenly couldn't administer a 4.7.4 site that's been running for months...

thanks for the tip...

bjornarneson’s picture

My site hosted on Mediatemple's gridserver broke yesterday. I'm assuming it had to do with their GRID1.1 update. The fix above solved the problem. Thanks for the tip.

donnoit’s picture

Worked.

Thanks swifty. Your post saved a frustrating evening for me.

billk2’s picture

I can only presume Servage did a similar upgrade to php recently.

I was just about to reinstall - luckily I spotted your post.

Bill /<.

Als’s picture

Our sites were moved to Servage recently, the user accounts stopped working and the session.inc modification fixed the problem.
Everyone having account problems with Drupal on Servage try this! :-)

mariagwyn’s picture

thanks, helped me as well. Is there a reason that this is not in the drupal 4.7.4 download package? Does it kill php4 if it is included?
either way, very helpful.
maria

David Lesieur’s picture

thehardings’s picture

Swifty!! Thanks heaps. that worked a treat!
dan

Ajay Pal Singh Atwal’s picture

You saved my day

valkoas’s picture

I am also at 4.7.4 and the suggested change eliminated my "access denied" problems. It was also due to an webhost upgrade from PHP 4 to 5. The session.inc file is located in the includes directory. Just make the one line change as Swifty suggests and the problem goes away. Thanks Swifty.

rareservices’s picture

Hi Swifty,

I faced the same problem after moving(drupal 4.7.x) from godaddy to my new host.

Mysql version in my new host is 5.x

After doing your fix, I am able to administer my site http://blogya.in

Drupal 4.7 works well in mysql version 3 or 4. When it moved to mysql version 5, we get this error. This is my understanding.

Ofcourse there may other reasons like not cleaning the cache , session table or etc.

In my case you fix worked well.

Thanks
http://blogya.in

fewdisc’s picture

Folks,
I have a 4.6 running site which has been problem free for around 9 months. Ater following several other posts, confirming users, user_roles and node_access are set up for anony access, I have a user 0, I swapped the session.inc to see if that would help. In fact, that was what allowed anonymous users to access the site again, but somehow, no longer creates the cookie for the users that try to log in. Now everyone is anonymous, including admin. While this makes the more accessible, it prevents me from posting anything, or my user population. I added the additional line to the include file:
register_shutdown_function('session_write_close');

but doesn't help. Any help is appreciated.

Vallenwood’s picture

I also have a site running 4.6. For me, all I had to do was add the line:
register_shutdown_function('session_write_close');
immediately after:

function sess_read($key) {
  global $user;

in sessions.inc. It sounded from your comment like you replaced the entire sessions.inc file with another one, and if so, it's likely you overwrote it with one for another branch of Drupal (like 4.7.x). Simply adding that one line, and doing nothing else, fixed it for me in 4.6.

ozlady’s picture

This worked a treat for me! Thanks so much!

ebernabei’s picture

I know there are two issues discussed in this thread. The one I refer to is where you login and the system seems to log you out when clicking around on your Drupal site. This is because the type of user you are known to be is dynamically changed in the session table from X to zero. Zero, to Drupal, means anonymous and presto...you seem logged out.

My question:
Drupal 4.7.4
PHP 4.4
MySQL 4.1.21
Apache 1.3.x
Linux 2.6.9

Is this fix with swapping MySQLi into settings.php the fix for THIS SPECIFIC config above with PHP 4.4?

I did the session.inc patch with no effect (after clearing browser cache etc...) BUT this is for PHP5 ...not 4.x anyways

My hosting provider is having one heck of a time getting mySQLi working with PHP so I want to be sure before I raise hell with 'em.

Thanks,

Emilio

swebmaster’s picture

I have 4.7.4 Drupal installation that has admin login but doesn't allow to do admin actions. I have to login every time I see (Access denied ) message, get to the next page but my actions are not saved. Please help.

PHP version 5.2.0
MySQL version 4.1.21-standard

found solution on another thread:
http://drupal.org/node/6696#comment-178585

Commented out following in user.module:
session_regenerate_id();

Added line below drupal_page_footer(); in index.php:
$GLOBALS['tempUser'] = $user;

VM’s picture

PHP 5.2 introduced a situation , have you tried this http://drupal.org/node/102114 ?

it is suggested to upgrade to DRupal 4.7.5 which has fixed this problem as well as a few other problems.

Lostbishop’s picture

Did you already try creating a directory named "PHP-SE" right under the root level? I know it sounds silly, but it worked for me.

DL’s picture

i'm was already preparing to move from 4.7.3 to 4.7.4 when the issue surfaced. now I can't follow the steps in preparing the site for upgrade because I keep access denied pages. How to I do work around this problem?

thanks a million

Live hard, Ride harder

Patrick M’s picture

I'm having this problem with Drupal 5.1 on both my development and productions machines, and I've tried everything suggested here with no success.

Devel: W2K, Apache 2.0.59, PHP 5.1.4, MySQL 4.1.7
Prod: CentOS 4.1, Apache 2.0.52, PHP 4.3.9, MySQL 4.1.20

I get the access denied message when I click on a button even though updates or whatever are actually completed in the background. Simply refreshing the page then returns the updated page.

First thing I did, right at the beginning, was to trace back on access_denied(), echoed some __LINE__ calls in what might have been relevant other functions, and the echo in menu.inc, menu_get_active_item() "fixed" the problem. Apparently defeating the header function by sending something before it allowed the registered user to be revalidated and there was no access denied message. I knew it was a dirty "fix" but I just echoed a new line in menu_get_active_item(), and for some reason everything worked fine on my local machine. Not surprisingly, it totally breaks on my remote machine, however.

When I looked into swebmaster's post, I found that session_regenerate_id(); is already in user.module of 5.1. I tried putting the $GLOBALS['tempUser'] = $user; in index.php, anyway. That didn't work except when I put it above the drupal_bootstrap function...but again, that's only because it outputs an error before headers are sent, and just a new line does the same thing--somehow works on my local machine but not remotely.

Anyway, I'm not sure how to resolve this, and any suggestions will be appreciated.

zaytouna’s picture

hey folks
am still in the setting process trying to figure out a way to set up drupal .
however i edited the settings.php file and i tried to access my site and it gave me several errors and i have no idea what that means since im not an expert in linux. so is anyone available to help?

please you can see whats happen if you look at this link http://www.zaytouna.org.ps/drupal-5.1/

thank you all.

mariagwyn’s picture

I may not be the best person to help, but it looks to me like drupal is either not finding your db or your db is not set up properly (missing tables). The first option is to check your settings.php file, and make sure you have correctly entered the db information. If you need more help, you will need to give more specific regarding your site set-up, structure, etc.

Hope that helps,
Maria

apage’s picture

I am getting an access denied after I log in as admin on my site. I log in and go to my account page which I set as front, but then when I try to click to any other page, it gives me access denied. It did this once a few weeks ago and self corrected, and now its doing it again. Same result in IE and Opera as I received in Firefox. I haven't changed or installed anything in the past week so I'm not sure why it would now be doing this.

majunor’s picture

I had the same problem. My Hosting Service changed the PHP version. To fix this I had to add this to my settings.php file:

register_shutdown_function('session_write_close');

Hope that helps

Jody Lynn’s picture

Thanks majunor. My problem arose out of the blue and was logging out users. Adding this line seems to have fixed it.

--Zivtech--

pcmeissner’s picture

I'm running Drupal 5.1 and I'm getting the 'Access denied' even when I logged in as Admin. The nodes show up show up (minus a flash file I placed in the template), but it's preceded by "access denied. The strange thing is that if I activate a panel in the main content area using the panels module the "access denied" banner disappears, and a placed flash file that I have in the template shows up and everything is perfectly normal. Why would panels suddenly remove the "access denied" banner? And what causes ut?

mhertenberger’s picture

I ran into the access denied issue too, after spending a fair bit of time creating menus, adding pages and logging in and out as separate users. It's probably a limitation in the cookie handling or similar - after I clear private data in Firefox, the error disappeared and menus were accessible as they were supposed to be.

number3’s picture

I upgraded from 4.7 to 5.1.

I'm getting an 'Access denied' when I attemp to access any page except for update.php. The update went fine without any errors.

I've made sure all my tables are utf8_general_ci, I tried both 'mysqli' and 'mysql' for my db_url and I also made sure my sesson.inc had the line: register_shutdown_function('session_write_close');

But I'm still getting an Access denied.

Can anyone offer any suggestions?

FreeFox’s picture

Had the same problem (LAMP5)

But there is so much written about this ... In the meanwhile I tried and tried and ... found a solution for my case, a very simpel one ...

I cleared the cookies for that site. It worked for me and I hope for some of you too ;-)

Greetz
Jan

tp’s picture

Hi all,

comment out as shown below the section in settings.php file before you start installation. It fixes all Access Denied problem that I encounter in multiple computer installations

/**
* We try to set the correct cookie domain. If you are experiencing problems
* try commenting out the code below or specifying the cookie domain by hand.
*/
#if (isset($_SERVER['HTTP_HOST'])) {
# $domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
# // Per RFC 2109, cookie domains must contain at least one dot other than the
# // first. For hosts such as 'localhost', we don't set a cookie domain.
# if (count(explode('.', $domain)) > 2) {
# ini_set('session.cookie_domain', $domain);
# }
#}

/**

steppevos’s picture

After struggling 2 days I got my site running on the localhost thanks to commenting out the cookies section in settings.php (see message above)! Thanks a lot tp!!

I am running:
Windows XP XP2
Apache2.2.4 (apache_2.2.4-win32-x86-no_ssl.msi)
PHP5.2.1 (php-5.2.1-Win32.zip)
Mysql5.0.37 (mysql-essential-5.0.37-win32.msi)
Drupal5.1 (drupal-5.1.tar.gz)

Steppevos

Paul_Gregory’s picture

Cheers tp! Your suggestion seems to have fixed my problem. Migrating my client's Drupal site from a remote Plesk virtual server to a local MAMP server has proved to be quite a pain in the behind. Besides the Access Denied problem I also had occurrences of this, this and this!

democraticvictory’s picture

Apparently, upgrading to php 5.2 causes this problem.

I found that adding the line:

register_shutdown_function('session_write_close');

to the sess_read function in session.inc

function sess_read($key) {
global $user;

register_shutdown_function('session_write_close');

THANK YOU!!!

NOW: This fix worked for me on several Drupal sites on several Drupal versions when our servers were upgraded to php 5.2

SO: If upgrading php causes the problem, I'd try this fix first. It is extremely easy to do and worked perfectly.

maatty2007’s picture

This post is enough to solve all problems:

http://drupal.org/node/6696#comment-10113

Regards

mbria’s picture

I also noticed same issue, but it wasn't related with session was an real-access problem.

If you have been playing with some different access modules (organic_groups, simple access, taxonomy_access...) your node_access table could be a mess.

If you decide to upgrade, all this mess will come up and you won't be able to login from your login block (although you will be able to go in with at /user), and at the same time, anonymous or logged in users will get an annoying "Access denied" page.

The solution in this case don't need a patch. As was said before, you just need to clean up your node table.

If you don't mind to lose some information, you can run this query:

DELETE FROM `node_access`;
#Or run any of those if you know the offender:
#DELETE FROM `node_access` WHERE `realm` = 'simple_access';
#DELETE FROM `node_access` WHERE `realm` = 'og_all';
#DELETE FROM `node_access` WHERE `realm` = 'og_public';
#DELETE FROM `node_access` WHERE `realm` = 'node_privacy_byrole_role';
#DELETE FROM `node_access` WHERE `realm` = 'node_privacy_byrole_user';
#DELETE FROM `node_access` WHERE `realm` = 'og_subscriberog_all';

INSERT INTO `node_access` ( `nid` , `gid` , `realm` , `grant_view` , `grant_update` , `grant_delete` )
VALUES ('0', '0', 'all', '1', '0', '0');

Would be nice if every module include a "full remove" option to drop it's tables and delete it's rows... but as far as I know, drupal don't support this feature yet.

jiangxijay’s picture

Similar problems, different solution.

Problem began after installing workflow_ng module.

Neither the -session patch- nor the -node_access empty- techniques worked.

I had to drop all tables installed by the workflow_ng module and then also empty the variable data for that module.

Voila ...

jmspldnl’s picture

I was having some problems with a site giving me a denied access page, but your query fixed the problem. Thanks!

MissyM’s picture

Thank you for posting this - it worked like a charm!

lafo’s picture

I got this very same problem after my provider changed character set and collation on some tables in the database (they were trying to "fix" corrupted rendering of non-western characters by playing around with the character encoding of the tables, changing latin1 to utf8_swedish).
After running
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

on every affected table, things got back to normal immediately.

Richard Laffers
laffers.net

davereplicant’s picture

This worked a treat. Was mysteriously starting to experience real trouble with my Drupal sites and added this line

register_shutdown_function('session_write_close');

to session.inc right at the bottom of the script and now don't get logged out of some sites and am able to log in to others which I was getting Access Denied messages with.

MAgic!

www.dawnofthereplicants.com

outofthegallery’s picture

i am having the same access denied problem, but mine is different because I can access everything through my admin account, but I have set up other authorised accounts, and they cannot access forums, events, or pretty much any content that has been uploaded from the admin account!
I have enabled access to these content types in administer>user management>access control so i dont know what else i can do!?

nirvanajyothi’s picture

Hey...think this would work(Iam running site o drupal 5.7,other versions need to be tested)

1.Go to post settings under content management and you will rebuild using the option "Rebuild permissions" under "node access status" and the option is well explained there as given under...

"If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Possible causes for permission problems are disabling modules or configuration changes to permissions. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings......"

But from other posts here i found some users cant find the rebuild permissions option in the post settings page.I dont know how,but it is true.Even me after clicking on Rebuild permissions(which was luckily there) the access denied error was removed.But,when i returned to post settings page the 'Rebuild permissions' option could not be found where it was!

2.Other way to get to the "Rebuild permissions" page is to type in the url
< http://www.yoursite.com/admin/content/node-settings/rebuild > and rebuild permissions.

Hope this work out fine.Confirm this solution if it works out for you.

xtfer’s picture

Nice work! No. 2 worked for me after all the others had failed. This is so easy it should be the first thing you try!

jwilson3’s picture

I'm still searching for a clean solution before digging around in SQL.... this one, (rebuild perms) didnt work for me. My problem might be different in that a registered user can access any content that is marked as "new" but old content it gets access denied.

James Wilson
Elementalidad

jnavane’s picture

Thank guy, Its working good... powerful info

interactiveallstar’s picture

I've just spent a day trying every method posted here to solve this strange problem.... been running drupal 5.3 based site on local machine fine, then uploaded to our dedicated redhat linux server.

I could login as admin user (uid 1) fine, but clicking on the 'administer' link or trying to visit www.mysite.com/admin/ brought up a server error page. I could access certian parts of admin such as www.mysite.com/admin/build/ but clicking 'save configuration' on many areas of admin caused error page to be displayed.

After spending the day searching the entire site for clues - thinking it was perhaps a permission, session, .htaccess problem i've discovered that it was a Memory Problem to cure it I increased the amount of memory allocated to PHP using the following line in my .htaccess file

php_value memory_limit 40M

I hope this helps someone out there - its been a very frustrating day!

abqaria’s picture

there are many variables here

and many solutions

which one should i choose

i use 5.3, multiple sites , same code, different databases

all things suddenly start to act weird

sometimes it gives access denied and sometime not

cannot diagnose the problem

darumaki’s picture

yea i think drupal has way too many things working in the background that produces such weirdness, combined with module developers who haven't quite gotten the grasp of how drupal works. I hope it becomes more stable with the next release.

jcummings’s picture

That was very helpful. I adjusted the setting in the php.ini file and set memory_limit = 1024M. Thanks for the post.

jordii’s picture

I've tried almost every solution stated before in this thread:

  • clearing the private info of Firefox
  • using another browser
  • clearing every cookie
  • modifying certain fileds of the database
  • modifying mysql user privileges
  • using mysqli instead of mysql
  • modifying settings.php before installing, specifying drupal directory or cookie policy
  • increasing server's memory
  • fresh-reinstalling server subsystems
  • creating other users (in this case the system does nothing when signing in)
  • In my case, the thing I did was change the drupal directory one level up on my public local directory tree, passing from http://localhost/htdocs/drupal to http://localhost/htdocs. Since I did this, I receive the Access denied error over and over again after submitting the first user data, no matter if i change the database and reinstall Drupal or if I do any of the operations listed above.

    Please, help me, or I'll have to purge the whole fucking System...

    Drupal 5.5
    Apache 2.2.6
    PHP 5.2.5
    Mysql 5.0.45
    Operating under Win32

    stop14’s picture

    i've been trying to lick a similar problem on one of my sites (Drupal 5.6/PHP 5.2.5/MySQL 4.1.21), and have lost sleep and sanity doing so. the symptom is (seemingly) random access denied errors which trip every now and again, even when refreshing the same page. not always, just enough to ruin the integrity of the site. i've gone through most of the solutions that have been posited in this and other "access denied" threads, and the issue persists.

    investigation led me to the $user object, which would be fully instantiated when a given page was functioning properly, and empty when an error occurred. figuring that there were sessioning issues, i compared the session variables in both cases via php_info() to see if i could spot any differences, thinking that perhaps the session cookie domain was off or something.

    turns out that the only difference was the session.save_handler, which registered 'user' (drupal's required handler) normally and 'files' (the php.ini default) during failure (to investigate, try printing ini_get('session.save_handler') in your page template). bizarre, considering that the session.save_handler is explicitly set to 'user' in settings.php.

    i have no access to change the default setting in php.ini, though changing the default save handler can introduce other problems in some php configurations anyway. i've tried changing it in .htaccess, but to no avail.

    still looking. this may be something, or a complete red herring. anyone's thoughts would be welcome.

    stop14’s picture

    just making a note: switching the session.save_handler to 'user' in php.ini seems to have stabilized the site.

    jordii’s picture

    I've reinstalled the Apache HTTP Server plus PHP and MySQL, now installing the parts separately (I used to use Anaska WAMP server), after having cleaned the temporary files and cookies with CCleaner. The problem seems fixed.

    fareasthill’s picture

    I did put in a pin as mysql website advised it is danger not put a pin.
    but now, I can not access any of my local host page. please help!

    fareasthill’s picture

    Quote:

    Welcome to phpMyAdmin 2.10.1

    phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server.
    Error

    MySQL said: Documentation
    #1045 - Access denied for user 'root'@'localhost' (using password: NO)

    Unquote.

    Above message come up when I tried to access phpmyadmin. Please help, how should I solve this! thanks..

    fareasthill’s picture

    Just redo all over again, uninstall and delete everything. and reinstall all over again.

    Anonymous’s picture

    Hi everybody,

    I have the same problem (although I expect these issues to have several distinct causes). Nothing but an "Access denied" screen smiled at me after the database wizard finished. All hints posted previously in this thread didn't help.

    Drupals index.php returns MENU_ACCESS_DENIED from menu_execute_active_handler(), followed by a call to drupal_access_denied().

    Does that mean there are permissions missing? If so, how to fix?

    Regards...!

    Anonymous’s picture

    Finally made it work by changing the Confixx "httpd Special" config. My session-settings where wrong since I misspelled something or so...

    As a hint for Netclusive VServer customers (and for myself if I ever run into the same problem again ;)), the proper settings to enter in Confixx are:

    php_admin_flag magic_quotes_gpc Off
    php_admin_flag register_globals Off
    php_admin_flag session.auto_start Off
    php_admin_value mbstring.http_input pass
    php_admin_value mbstring.http_output pass
    php_admin_flag mbstring.encoding_translation Off
    php_admin_value session.save_handler user
    php_admin_value error_reporting E_ALL&~E_NOTICE
    php_admin_value session.cache_limiter none
    <Directory "/home/www/##user##/html">
    Options +FollowSymlinks
    Options -Indexes
    ErrorDocument 404 /index.php
    DirectoryIndex index.php
    </Directory>
    

    BTW, don't forget to remove all PHP options from .htaccess (would result in "500 - internal server error")

    willeaton’s picture

    Hi, Im having the same problem "Access Denied", its nothing to do with database access (because drupal works) and its not a problem when logged in as admin.

    I get "Access Denied" when I am not logged in and I know why although not the solutions. I have noticed that only recently the "NODE_ACCESS" table in the database is no longer being updated. I do not have any node access modules installed however I did have the workflow installed and now removed.

    The following is a list of things I have and have done...see if anyone can match mine against theirs...

    Original install drupal 5.2 moved from local server to remote
    created another user group including one called "superuser" (maybe a problem???)
    removed workflow although not the database tables
    CCK modules installed,Multilanguage i18n,HTMLarea,Menu trim,Views

    Tried:
    Upgrading to 5.7
    removing the workflow tables

    Success with adding this in database
    INSERT INTO node access (0, 0, all, 1, 0, 0)

    THIS IS NOT A PERMENANT SOLUTION, why do I have to put access *??? What caused the add content form to stop updating the node access table???

    Hope that helps someone
    Will Eaton

    Sinankuday’s picture

    First, I tried DRUPAL on my local network (with Zend Core) and worked so well. Then i decided to set it up on my remote host.
    Problems occur right after that. First i bought a new hosting from Networksolutions and then configure a php.ini for turn off "register_globals". Installation has past ok.

    Using admin account i tried to open some modules but "taa taaaa" here i got the first bug: "Access Denied"
    And then i tried every way to fix problem but no solutions yet.

    When i look back and observe my local network (where is the DRUPAL runs so well), there's only one possibilty to have "access denied" rror: It's bcs of "PHP CONFIGURATION". That's the only difference between my local network and remote host.

    Am i wrong??

    Sinankuday’s picture

    I fixed the problem: Uninstall DRUPAL 6.1 and instal 5.7 ... Nicer version without a few difference

    perke’s picture

    Hi all,

    I just upgraded from 4.7 to 5.7 and having a weird issue... I'm getting "Access denied" only on two admin pages:
    admin/user/access and admin/user/roles
    I dont even have them in admin/user menu but can only access it from modules menu (?). Other pages in User management are ok like admin/user/settings, admin/user/user and so on.
    As far as I noticed, upgrade went fine without any errors. Does anyone have an idea what can cause this?

    I tried cleaning browser cache, cookies and what not...any help will be greatly appreciated.

    VM’s picture

    try clearing the cache tables in the Database.

    _____________________________________________________________________
    My posts & comments are usually dripping with sarcasm.
    If you ask nicely I'll give you a towel : )

    perke’s picture

    just tried and didn't help...another thing I noticed, just installed Views and getting "acces denied" on build/views too. update & enabling/disabling views didn't help either

    VM’s picture

    check administer -> post settings is there a button to rebuild your access table ?

    _____________________________________________________________________
    My posts & comments are usually dripping with sarcasm.
    If you ask nicely I'll give you a towel : )

    perke’s picture

    nope... just regular post settings stuff, Post length;Number of posts on main page;Preview post;
    it seems that upgrade didnt go quite well

    crandell’s picture

    wow -- the admin / post settings / node access made my problem disappear. my anon wasn't able to access any content. thanks for saving me hours of time fretting over my broken site!

    joesp’s picture

    worked like a charm! I have complete access now! thanks for the pointers!

    wanderingstan’s picture

    I have the same problem.

    As suggested I tried this:
    INSERT INTO node_access (0, 0, 'all', 1, 0, 0);

    But no luck, and it looks like that row was already there.

    I can't figure this out. Whatever the problem is, it seems drupal should give a better error message. I am clearly logged in (and as the admin user--the only user!) but can't get to the admin pages or my own user page.

    In my case, the problem is only on my local development copy--an exact snapshot of what I have running on the live server except for a different database specified in settings.php.

    Anyone have other things to try?

    zemliansky’s picture

    I have a different kind of problem. I have been running a Drupal 6 site for months with no problems. Then, all of a sudden, select users are reporting "access denied" error while others and myself, the admin have no trouble. As far as I know, no one changed any settings. They have tried deleting stuff from their browser, etc., Does anyone know what this might be about?

    Thanks.

    pz

    lungtung’s picture

    i got similar problem Error 404 Page not found on Drupal 6.2 -> ive no idiea with this problem
    and Access Denied on Drupal 5.x -> ive solved by follow this topic

    ill happy if someone tell for us how to solve that problem :)

    sweseb’s picture

    Same problem after having moved my site. Version 6.2. Nothing of the above worked for me. Is there really no fix for this?

    electronicmonkey’s picture

    Mine is a very strange case indeed . I can access all pages and views as an administrator , but when I log in as authenticated user I get "Access Denied You are not authorized to access this page." for some nodes (especially pages) and some views such as audio and video just show a blank page. I have changed all permissions to give unrestricted access to all groups but nothing changes.

    biff21’s picture

    Hi, I have a similar problem with video pages. When I grant authenticated users admin priviliges they can access video pages, but when I take them theses privileges away ( access content still active), they can`t access the video nodes anymore ( "access denied ..."). Now I tried all methods in this thread, but still have no luck : ( . The strange thing is that I have 2 video nodes that are working properly ( authenticated users can access them ). But when I create new video nodes described problem appears. Could it be something with the video nodes ( openPackage btw )?

    sarne’s picture

    I just upgraded to 6.2 today (from 6.1) and then all of a sudden all my Pages are giving me "Access denied: You are not authorized to access this page." on ALL accounts. Normally, even anonymous users have access to all pages. Checked all my permissions, nothing changed there. Any other ideas?

    sarne’s picture

    I had completely forgotten that I had installed and activated the plink module right after my upgrade. I started deactivating modules and when I deactivated that one, I got my access back.

    Mangaforce’s picture

    I had same problem.

    my solution: drupal 6.0x - man i only put somthing in the mission statement and deleted it. next thing i know "Access Denied"

    Anyway: Use the Front page module ! http://drupal.org/project/front
    Go to > Administer > Advanced front page settings > set front page to: front_page
    Go to > Administer > Site Information > Set Default font page to: front_page
    Go to > Administer > User Management > Permissions > Scroll down and tick the box for [front_page module] for anonnymous user..

    that should sort it.. well it sorted mine. but im a newbie what do i know :D

    - hope it helped

    www.casinogamblingindex.com - First Drupal Site

    kevin hogan’s picture

    This worked for me!

    fried_tomato’s picture

    I'm new to CMS-type systems & recently installed Drupal v6.2 on my computer to try it out using apache2triad, per a suggestion in the Drupal Documentation section.

    I get the "Access denied, you are not authorized to access this page" message in the css_injector module when I click on the "create a rule" link.

    I have no trouble accessing any of the other modules, including other contributed modules, so I don't understand why this one acts up. I know zip about how to change write permissions, chmods or node accesses, so I haven't done anything except basic install.

    One thing I noticed is that the v6.2 readme documentation says the drupal-6.2/modules folder is only for core modules and to put all contributed modules (such as css_injector) into the sites/all/modules folder. But when I put contributed modules into the sites/all/modules folder, they do not show up on my Administer >> site building >> modules page. When I put contributed modules into the drupal-6.2/modules folder, they show up on the site building/modules page so that I can check them to enable them. ... Does the module location affect access permission?

    Does anyone know why this is module-specific "access denied" is happening & what to do about it?

    rand0mmm’s picture

    Hi there Useful Thread.

    An anonymous user can get to my page: http://mysite.com/?q=node/7
    but not to the same page called by freelinking: http://mysite.com/?q=freelinking/Contact

    Did I misconfig freelinks?
    I tried rebuilding user permissions cache. no change.

    This is odd, but when I call the generated freelink as an admin, I get the top Url.
    As an anonymous user, I see the lower Url!

    Please Suggest things to try. I am an experienced CMS'er, but learning DRUPAL these past weeks.

    nirvanajyothi’s picture

    Hey...think this would work(Iam running site o drupal 5.7,other versions need to be tested)

    1.Go to post settings under content management and you will rebuild using the option "Rebuild permissions" under "node access status" and the option is well explained there as given under...

    "If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Possible causes for permission problems are disabling modules or configuration changes to permissions. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings......"

    But from other posts here i found some users cant find the rebuild permissions option in the post settings page.I dont know how,but it is true.Even me after clicking on Rebuild permissions(which was luckily there) the access denied error was removed.But,when i returned to post settings page the 'Rebuild permissions' option could not be found where it was!

    2.Other way to get to the "Rebuild permissions" page is to type in the url
    < http://www.yoursite.com/admin/content/node-settings/rebuild > and rebuild permissions.

    Hope this work out fine.Confirm this solution if it works out for you.

    "Give me a place to stand and I shall move the Earth" -Archimedes

    d_arcy_0’s picture

    i have same problem, i tryed this solution but didnt work. where can i find the keys to control the acces??--

    sergmain’s picture

    Rebuild permissions work for me. Tnx you.

    FYI: Drupal 6.2, PHP 4.4

    sukioki’s picture

    my access denied is working just fine -
    that's the problem

    i don't want anonymous visitors to enter, but i also don't want them to be yelled at!
    i'd just like the text ACCESS DENIED to be invisible.

    Any way to make it disappear while still working?
    btw, i know nothing about coding, so i need some hand holding...

    thanks!

    jwilson3’s picture

    Sounds like a completely separate issue that could be solved with some css. Why not start a new thread?

    James Wilson
    Elementalidad

    sukioki’s picture

    i think if it's just css maybe i can figure it out. maybe instead of making it friendlier, i will make the page go darth vadar black w/ yellow words...

    it's about no. 45 on my list of issues right now though!

    and hey! thanks for answering! everyone else seems to be grouchy or hiding!

    jwilson3’s picture

    I replied to this post already here) but its far above.....

    The situation on one of my sites (Drupal 5.2) is also kind of strange in that only content pages that are labeled "new" can be accessed.

    With the help of the tracker page, a given authenticated user can see which are the newest pages, and access them fine. But older pages all get access denied!

    The rebuild perms didn't work to solve this problem.

    James Wilson
    Elementalidad

    suthy’s picture

    I'm working locally for now, but I've been getting access denied too.
    I have two users that I created: administrator (with all permissions) and another (with limited access content, etc. permissions). I'm using the ATCK theme for the site and garland for the admin area. Once I got the bulk of the site functioning, I took a break to style the ATCK theme with CSS and now I'm trying to log back into admin to make internal changes. I didn't make the admin navigation display on the ATCK theme because when I'm logged in, it uses garland, but now in order to login I have to manually go to localhost/admin.
    However, the second I hit login, it shoots me back to localhost/?destination=admin which is just the site with all the ATCK theming I've done. If I try to access localhost/admin/settings or any other location manually, I get the garland theme, but access denied.

    It's like it doesnt actually login.
    Anyone know how I can get back into admin?

    thank you for any help

    nirvanajyothi’s picture

    Couldnt undstand completely...maybe bcos i read it in hurry

    You may try this ...Try Rebuilding permissions manually tif you can access it

    http://www.yoursite.com/admin/content/node-settings/rebuild

    (Unrelated to post:Chk out http://drupal.org/node/171205 for theme related documentation for D6.You may find this useful for theming)

    suthy’s picture

    sorry. i'm using drupal 5 so no help there. i can't access anything it seems. it just spits me out to my ATCK theme with the path mysite/?destination=admin/content/etc.
    Then if I ditch the ?destination=, I get back to my garland login page with an access denied message and it won't login even though i'm using an administrator role with full permissions. it's almost to the point where i think i may have to redo it, but i'm so far along, i'd rather not

    ...wait, tried going to /?q=user and got in! fixed!

    nirvanajyothi’s picture

    Activate clean URLS so that all the ? gets removed from urls and things will be less confusing.
    It will be under yur site configuration

    Medicine, Surgery ...and Drupal.

    Metusela’s picture

    I have spent several hours reading though most of all the comments here. I don't mean to be rude, but this is probably the worst tracking of a problem I have seen. The same solutions pops up +10 times. Can't you read? Clearing the cache and cookies didn't solve this issue. If it did this thread wound not be alive over 3½ years since the fist post!!

    I can honestly say that I have tried ALL suggested solutions I found here. I still have the same problem. Why? First of all, is there a precise description of the problem? Well, strangely I didn't find any. Yes, I did find some comments describing the problem. But it seems every one is talking about a whole bunch of different problems. No one has found a good solution, because no one described the problem.

    So let me describe the problem I experienced:
    -I encountered this problem when I copied a live drupal site to my local machine for testing.
    -All files and folders are a exact copy of the live site.
    -I exported the database, and imported it on my local server.
    -I made the necessary changes to let drupal make connection to the database on the "new" server.
    -All pages work in the same way as on the drupal site. So the connection to the database works.
    -When I log in I don't get to the userpage as usual. Instead I get the "Access Denied" page.
    -The same happens for all users.
    -If I type the wrong password I get a "wrong usernamn or password" message.

    Previous system (live site):
    Linux, PHP 4, Mysql 4.1.2

    Current system (local test):
    Windows XP, XAMPP 1.6.6, PHP 5, Mysql 5.0.51

    Drupal 5.10
    + CCK
    + Views
    + Taxonomy Menu
    + Admintration Menu
    + more modules

    I will say it again. I have tried every applicable solution for this problem, without success.

    So, PLEASE, tell me exactly how the access works in drupal, and what went wrong, and how it's fixed.

    nirvanajyothi’s picture

    Am not here with a genius solution to your problem.YOu have reported the error in such detail and i dont want you to feel disappointed before you get a good solution to it.
    But one thing I noticed in this thread is there are only few users persisting with their question.Think its because they got their error solved some way or the other.Or may be spontaneously that they didnt want to come back here and report the solution.

    Also different solutions have worked for many.You may try your luvk here...doing things with your test site a while and see if the error disappears.

    Medicine ,Surgery ...and Drupal.

    Metusela’s picture

    Well... the thing is that I did just that ... test the solutions posted in many of these comments. It didn't help. If it would I'd never post anything about this. I always try look for some solution to my problems on the forums. But no luck this time.

    The worst thing is that all I can do is modifying the files and the database. Both methods are just for extreme cases. But because I can not log in at all I can't access any settings through the menus. Not even through direct urls, as some one suggested earlier.

    This is what makes it such a serious issue. If there isn't a solution for it I will not be able to move a drupal site from one server to another.

    VM’s picture

    because you moved from PHP 4 to PHP 5 did you set mysqli in settings.php rather then mysql ?

    I'd be curious of the results of a site move from/to a matching environment rather then an environment that is altering major version of both PHP and MySQL.

    Metusela’s picture

    Done that.

    As I said, that solution has already been suggested. I tried it and it did NOT solve anything.

    If it would solve the problem I would never have posted anything here.

    The database works and drupal connects to it correctly. I already have "mysqli" in my settings.php.

    From my settings.php:

    $db_url = 'mysqli://drupal:*password*@localhost/bagjakt';
    $db_prefix = '';
    
    $base_url = 'http://localhost/bagjakt'; 
    ini_set('arg_separator.output',     '&amp;');
    ini_set('magic_quotes_runtime',     0);
    ini_set('magic_quotes_sybase',      0);
    ini_set('session.cache_expire',     200000);
    ini_set('session.cache_limiter',    'none');
    ini_set('session.cookie_lifetime',  2000000);
    ini_set('session.gc_maxlifetime',   200000);
    ini_set('session.save_handler',     'user');
    ini_set('session.use_only_cookies', 1);
    ini_set('session.use_trans_sid',    0);
    ini_set('url_rewriter.tags',        '');
    
    $cookie_domain = 'localhost/bagjakt';
    

    Didn't you read what I said? I have tried all kinds of solutions posted here, and because NONE of them solved the problem I asked for a DIFFERENT solution.

    Php4 is dying and a direct consequence is that hosting providers all over the world upgrade their systems. That makes this issue quite interesting because it can affect almost every drupal site that is still running on php4.

    So, I'll ask again, is there any one out there with another solution to this problem?

    VM’s picture

    forgive me for missing a small comment in this long thread about insuring mysqli is being used.

    Good luck.

    Metusela’s picture

    Silly, Silly, me!! I apologize if anyone thinks I've been rude!

    I just managed to find a little little thing in my settings.php that solved the problem.

    # $base_url = 'http://localhost/bagjakt';

    See the problem?

    removing the little # fixed it!

    That is the reason I am not a programmer!

    Please ignore my previous posts here. I just have to be more thorough.

    czingerline’s picture

    I was experiencing the dreaded 'Access Denied' error only on ONE particular page (/blog). In order to fix this I tried a number of different approaches based on information I saw on the web. I changed permissions, cleared cache, changed my httpd.conf file, changed my .htaccess file and no luck. What was it?? I actually had a node already created that had a 'blog' url_alias. I had to delete the old node url_alias and then BINGO, all was fine.

    To find the record run a query like: SELECT * FROM url_alias where dst like '%yourpage%'
    Then run a delete on that row or change the dst value.

    Hopefully this will save some of you some time, it took me a while to figure out.

    Craig

    JuliaKM’s picture

    I ran into this problem after I added a switch in my settings.php file for the database so that I could easily switch between my local and live databases without having to edit settings.php over and over again.

    //PRODUCTION
    if ($_SERVER['SERVER_NAME'] == 'mysite.org'){
    	$db_url = 'mysql://user:pass@mysql.mysite.org/my_db';
    }
    
    //JULIA-LOCAL TESTING
    if ($_SERVER['SERVER_NAME'] == 'localhost'){
    	$db_url = 'mysql://root:root@localhost/mydb';
    }
    

    I tried to first solve the problem by rebuilding node permissions and clearing my cache. What solved the problem was uncommenting the $base_url and adding the following.

    //PRODUCTION
    if ($_SERVER['SERVER_NAME'] == 'mysite.org'){
    	$base_url = 'http://mysite.org';  // NO trailing slash!
    }
    
    //JULIA-LOCAL TESTING
    if ($_SERVER['SERVER_NAME'] == 'localhost'){
    	$base_url = 'http://localhost:8888/work/mysite/www/trunk';  // NO trailing slash!
    } 
    

    Please let me know if you have any questions. I'm using PHP 5.2.6, MySQL 5.0.67 and Drupal 6.5.

    dsandif’s picture

    I am the same issue on a iMac. I am running Drupal 6.6 on Leopard using MMAP running PHP 5.2.6 w/ MySQL client version 5.0.41. I tried to edit the settings.php file as it was suggested above but for whatever reason, I couldn't get the permissions to stick so the changes would be permanent. When I am logged in as an admin, I can see, change and view all the web pages that I've created or changed, however, the moment I log out, I start getting that dammed "Access Denied, You are not authorized to access this page" crap. I seem to be having the reverse problem of what others are dealing with. Any how, if anyone has any ideas, please let me know as I am stumped at this point, thxs.

    dsanif

    PS,

    I was able to finally edit the settings.php file, but it didn't work for me in resolving my problem.

    darumaki’s picture

    I recommend moving development site to a live server aka test.yourdomain.com. Drupal on local mac/pc sucks, on the server its better for testing purposes.

    Also if you are using MAMP on mac, it resets permissions on files without your consent. I think MAMP PRO has an option to define the permissions.

    >>>>>>>>>>>>>>>>>>>>>>>
    contemplating the meaning of existance, what else would I be doing

    dsandif’s picture

    Thanks for the input darumaki ,

    I am currently looking at a duo-core pc\ production server to transfer my site to although I'm not sure as to how hard it will be to transfer a drupal site created on a mac to a pc. In the meanwhile, since I'm using the free version of MMAP, where would I go look to inside it to see if it in fact has changed my permissions settings on my web site files? Again, the strange thing is that as admin, when I'm logged in, I can see and access everything, but when I logout and try to view the site as a plain ole' outside-looking-in user, I get the "access denied" crap. Just don't know what the heck I did to screw things up. Thxs.

    D-

    hedac’s picture

    I had access denied for admin and taxonomy etrms and It was Views module
    http://drupal.org/node/319540#comment-1266308

    khan2ims’s picture

    Last week I also faced same problem. After wasting one whole day after it, and pulling my hairs, I went into database and ran this query
    INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);

    And Voila! Everything started working fine!

    Imran Khan
    Project Manager
    New Earth Marketing

    VM’s picture

    in drupal 6.x you can go to administer -> post settings and if the node_access table is in disarray there will be an exposed button to rebuild the table.

    sunyata’s picture

    I have tried most of the solutions listed here except Geotechy .

    Running 'Harry Slaughter's workaround, I get following but problem persists.
    mysql> INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
    ERROR 1062 (23000): Duplicate entry '0-0-all' for key 'PRIMARY'
    mysql> INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
    ERROR 1062 (23000): Duplicate entry '' for key 'name'
    mysql> INSERT INTO users_roles (uid, rid) VALUES (0, 1);
    Query OK, 1 row affected (0.00 sec)

    FreeBSD
    MySQL
    Apache
    Php 5.2.6
    Drupal 6.13 (brand new installation...Zend Framework disabled)

    Anybody has a brand new solution? Thanks.

    andersiversen’s picture

    setting '$cookie_domain = 'example.com';' in settings.php to the wrong domain also generates this access denied error. For example if you wrote '$cookie_domain = 'exmaple.com';', on the domain example.com you'll get the access denied on all pages.

    - I've got a new pal - Drupal. We play all the time.

    kyleremp’s picture

    Finally figured out that the recommended changes I made (incorrectly) in regards to FCKEditor and IMCE to the settings.php file, were the culprit.

    I have my Drupal install located in a subdirectory on my server, so I thought that I should set to:

    $cookie_domain = 'mysite.com/mydrupaldirectory';

    however, I corrected to:

    $cookie_domain = 'mysite.com';

    and now everything is just peachy. Good luck.

    Billy_Bamford’s picture

    I've been working on a big drupal site which I've had installed on my own server as a subdomain (so this might be client.example.com). I have just sent the site live and therefore moved the site files (and all assets) to a new folder on the same server (so it now also appears on www.client.com). No changes to the database were needed as the development site and live site are hosted on the same server.

    The site looks fine, however when I go to log into the admin section on the www.client.com domain with any of the usernames and passwords I had set up I am getting the "Access denied You are not authorized to access this page." message. I can still login fine at client.example.com.

    Thanks for your help!

    Billy_Bamford’s picture

    OK. I've just figured it out. In the Drupal settings.php file there's a line referring to the site cookies:

    $cookie_domain = 'mysite.co.uk';

    This was pointing at the old sub domain; not the new one.

    joyreji143’s picture

    this the message i get when i try to share or access a pc on the network.i tried adding from control panel .administrative tools..local security policy..still the same..

    sierrawayfarer’s picture

    "you are not authorized to access this page", this is normally a permissions message. It happened to me once when I added new modules. I was the 'administrator' but for the extra functionality added by the new modules I had not yet given my self permission to manage them. For you though I think it is something different.

    When you installed did you get all of the way through the installation process with the database connection made and to the home page? I have doubts.

    Since you have not created any sites yet I would start over and make sure you get all of the way through the installation process without any error messages. If you get error messages and get stumped by them please post them here.

    Tafa’s picture

    I am going through the same. I have an "edit profile" link with the correct URL. When I click on it as an admin or a normal user, I get the error message. I tried to change my permissions but to no avail. I saw that we could change stuff in phpadmin but my knowledge about it is limited at the moment. So, it would be great if someone could help me sort out the problem.
    Thanks
    T,

    aforsyth’s picture

    My situation was this:
    - Installed the 'Acquia-Drupal' Drupal 6 complete package (web server, database, etc.) on my Mac last week
    - No problems with any login at first - set up a site with several users etc.
    - Exported site & database to live server, no problem
    - Continued work on my local Mac copy today, could still log in as admin (and see my user page using localhost:8082/?q=user), but any other path produced the 'Access Denied' message (e.g. a path like localhost:8082/admin/).

    I tried checking the database users & permissions, but that all seemed ok (according to the above comments), but finally I've found the solution. I uncommented the Rewrite Base in the .htaccess file in the root site folder, i.e. I changed the line:
    # RewriteBase /
    ... to:
    RewriteBase /
    ... then saved the file, refreshed the browser, and suddenly I could access localhost:8082/admin etc.

    I don't fully understand why suddenly now I need to specify a Rewrite Base, but it's sorted out this access problem.

    Note that since Apache .htaccess files only work on Linux and Mac OS, this probably won't be useful to Windows users with a similar problem.

    Alan

    redasakhi’s picture

    Hello everyone ;)
    you have just to check the "session.cookie_domain = xxxxxx" in your php.ini
    it has to be :
    session.cookie_domain =

    make sure there is nothing after "="
    I hope this help ;)

    have a nice life ;)

    phpsharma’s picture

    redasakhi ::
    Thanks for the tip..

    Need to check in Settings.php

    # $cookie_domain = 'example.com';

    bsenftner’s picture

    Thank you! Thank you! thank you!!!

    siva.thanush’s picture

    Could not find the admin username and password?
    when i try to enter i am getting the msg like this
    "Access denied
    You are not authorized to access this page."
    i m using karmic,drupal 7.
    pls help me.

    Siva

    taggartj’s picture

    to t.sivasubramanian .... look at your data base and eg in the table user ....and look at id 1 .... there you will find your user name ...if it is not admin he he ....edit the password by clicking edit type in a new password ...then go ...then edit and select md5 and then go ...you have now changed your password ...

    BUT As for" Access denied You are not authorized to access this page."

    look in your settings.php file and scroll down until you find '$cookie_domain' if it is not set to your domain name change it !
    (i found out the hard way after a site move / clone )

    aangel’s picture

    Cookie domain was the problem for me...put a # in front and can now log in fine.

    IWasBornToWin’s picture

    If you're running OG, you must go to Og settings and add your new content type to the list or you will get an Unauthorized Access message, even as Admin.

    Wise Horse’s picture

    I had the problem when logging as admin or any other user and tryed all these comments but no success.

    mysqlcheck didnt show any problem with database so I thought its ok but when I tryed to dump db I saw that session table is corrupted. So I did:

    mysql>repair table sessions;

    And this solved the problem with logging in. Hope this will help somebody.

    joshuautley’s picture

    I got a call from my client after i upgraded them from 6.16 to 6.17 to let me know they couldn't log in. Soon i found out I couldn't either. So,...

    Commenting out the cookie part of the settings.php file worked.

    #$cookie_domain = $base_url;

    Josh Utley, President & CEO
    Intrepid Network Inc. | Multimedia Services & Business Solutions

    "Our mission is to provide a more personable multimedia service along with the highest quality business solutions."

    web506’s picture

    Hi joshuautley,

    I am having many many problems too. Problem is that I have a live site running and I am loosing customers every day. I got totally confused of what could happened, I am still thinking about 2 modules I might have installed but I removed them and the problem is still there. So now that I am reading your comment above about updating from 6.16 to 6.17 I started thinking I did that last week, and that is when I started having issues.

    People will register and right after get an access denied page, or even some other were not able to log in. Some other users were able to log in after the second try, some did not had problems at all. Well I am talking in past but reading your comment I am positive, hopefully this will help me too, otherwise I am lost and I might need to re do another drupal installation or I have no idea actually. Thanks, I will reply as soon as I check that everything is running smoothly after 2 days.

    Gonzalo Garcia
    Freelance Webmaster

    jwilson3’s picture

    Many different things could cause access denied after login.

    * Ensure the $base_url in settings.php, if being used, is correct. Sometime when you get logged in from one site, the base url processing sends you to another version of the site (eg from dev, to staging, or production) where you are no longer logged in.
    * Ensure cookies are enabled.
    * Ensure that if you're using the $cookie_domain in settings.php, that it's setup correctly.
    * Provide more information when you report issues, Eg, What's the URL of the page where you're getting redirected and getting 403 error after login?

    jwilson3’s picture

    @joshuautley: You should't try to set the $cookie_domain to the same thing as $base_url.

    If you look in the default.settings.php provided with Drupal, you'll note that the format for the $cookie_domain global is different than that of the $base_url.

    $base_url = 'http://www.example.com';

    $cookie_domain = 'example.com';

    jwilson3’s picture

    I'll throw this out there too... I've had some more advanced setups with 2+ sites, that use shared user + session tables.... and one site is at www.example.com and another at subdomain.example.com

    In this case, for login to work for both sites, you need to have the $cookie_domain setup as '.example.com' (note the preceding dot) on both sites' settings.php file.

    Pjotr Dumat’s picture

    Tnx James ! Was able to log in with IE however not with chrome. With the extra '.' it is OK on both

    shabanbi’s picture

    plz can you give me solution ,my admin,users pages shows " Access denied
    You are not authorized to access this page.", how to solve this one plz give me solution

    akosiana’s picture

    simply don't hide the login in the blocks, anyway it will automatically be hidden once you logged in, that solved my access denied issue..

    paddywwoof’s picture

    THANKS swifty (above http://drupal.org/node/20397#comment-177472).

    After going round in circles trying to sort out why a site I had set up for someone several years ago now refused to be logged into.

    Nilesh Sawant’s picture

    Hi friends,

    I was also getting this error after creating content,
    for solving it i googled for two days, as their was too many post of different solution for the same problem, but not a single one of them was working,
    so i tryed to solve it by myself.

    the solution is very simple, you just have to login by administrator and in modules check that their are no disabled items over their, you can make them enabled by clicking on them, specifically on node,locale,content Tranclation.

    then go to node-> permission, check on

    Access the content overview page
    Access the content overview page
    View published content
    View published content
    View published content
    View own unpublished content
    View own unpublished content
    View own unpublished content
    View content revisions
    View content revisions
    View content revisions
    Revert content revisions Anonymous and then save it, and log out.

    then the message will not be their.

    be happy, and make others happy, by giving solutions.

    prezaeis’s picture

    hi guys
    im running dp6 and using audio module
    everything on site works, except when i try to use the audio import module, this used to work before but suddenly recently it doesnt, when i try to import audio files i get You are not authorized to access this page.

    iv checked all write permissions and everything seems fine, i jus dont get it

    any ideas?

    prezaeis’s picture

    there is an error in the audio module upload script, iv managed to edit it to fix the error but dont have the code here with me, a work around is to only upload 45 files or less at any one time

    if u try to upload more than 45 files u get this error

    sboots’s picture

    Had a similar problem after moving from Drupal 5 to Drupal 6; the site looked fine to authenticated users, but anonymous users got the "not authorized to view this page error" on every page.

    The fix was, using the "Rebuild Permissions" button that's hidden on the "Content" -> "Post settings" page in Drupal 6. (eg. admin/content/node-settings)

    Node access status
    If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Possible causes for permission problems are disabling modules or configuration changes to permissions. Rebuilding will remove all privileges to posts, and replace them with permissions based on the current modules and settings.
    Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed posts will automatically use the new permissions.

    There's a button directly below that text that solved all of our problems. : ) Cheers!

    FredderickSmith’s picture

    Here is a detailed account of my issues, and their resolutions, hopefully these can help someone. My issue is with Drupal 7 and Access Denied errors relating to changing theme settings:

    http://drupal.org/node/1114770#comment-4840588

    If someone searches on this, and hits this page as I have, this might be helpful.

    lisungroup002’s picture

    same problems^^^^learning

    johnvsc’s picture

    After going through all the system configs that this thread (and other blogs) have talked about - I compared my local MySQL with the server / colleagues whose installs were working fine.

    Turns out, my version (MySQL 5.5) was newer than the others (MySQL 5.1).

    I ripped it out (i am on Mac OS X Snow Leopard - no MAMP or XAMP following these directions -> http://www.brianbruijn.com/?q=node/24 ) and installed a legacy version (http://dev.mysql.com/downloads/mysql) and everything snapped into place.

    Granted, along the way, i changed ALOT of config options ... so I am sure that they also helped the situation.

    Hope this helps anyone on Snow Leopard !

    dhksrikanth’s picture

    how to view site configured in drupal in local host? not admin but actually developed site. I wanted to upload it on my production server.

    VM’s picture

    In future please create a new forum topic for your question. It's not related to this original post best I can tell.

    Answer:
    if you upload it to a server you view it on that server. If it's on localhost and you have the proper environment set up on your local machine you view it on that local machine. If you don't want to view it as an administrator. Logout and view it as an anonymous user.

    If this does not answer your question please consider being more verbose in a new forum thread. Thanks.

    anibechren’s picture

    Живой сайт! Частенько ныряю сюда. Отличные материалы, интересные.

    olaf.dietsche’s picture

    This is with Drupal 7.

    I had a similar problem. My installation works fine on localhost, but when I switched to example.com, I couldn't login anymore.

    I use Firefox and Cookie Monster. The simple and embarrassing solution was to allow Cookies for example.com in Firefox/Cookie Monster.

    abdulali89’s picture

    personally the issue was solved after allowing anonymous user permission to "View published content"

    donnaafifi’s picture

    If you have just found that your IP is banned, get a VPN account https://www.iwasel.com/en/ I was blocked, got the account.. connected with no degradation in speed... and was in business again! It's a great solution.

    pesmodroid’s picture

    how to solved access denied from any web page?

    Brainvire’s picture

    I had this problem and I tried the fix running 5.7. It wasn't throwing the correct error. I found that the sessions table was corrupt. If you look in the logs you will find

    Error - Can't open file: 'sessions.MYI'

    Check and see if you can select from the sessions table. If not, then run

    sql>repair table session;

    FIXED

    Vako’s picture

    I was having the same Access Denied error on some systems with Drupal 6x
    Ran the SQL session repair option as mentioned above and it fixed the issue.

    ajitsandip’s picture

    IN Drupal-7.x-dev version admin is login then admin is log out suddenly admin is access denied then next login time is not avalibile username and password then direct redirect main page without content of menu bar of home ,dashboard,content,structure,appearance,people,module,configuration,report,help plz give solution sir

    VM’s picture

    ajitsandip you really need to take the time to create a proper forum post and ask your question instead of trying to hijack multiple threads that have little to nothing to do with your issue.

    aidairawan’s picture

    already have solution?

    sztajer’s picture

    So as i wrote i had same issue, but all what i did to fix it was deletion first row in user table, this row with id 0, and It works ;)

    MediaFormat’s picture

    EDIT.

    VM’s picture

    UID 0 is the user utilized for all anonymous users. removal is likely to cause other issues.

    raghwendra’s picture

    I got the same problem for transferring as website from the one host to stage host and when i was trying to login got message access denied. I got solution after changing $base_url in our settings.php file. For your problem you may also check this.