I'm seeing a lot of these posts, but not many that deal with 5.1 specifically.

System:
Drupal 5.1 stable (same problem with 5.1-dev)
Apache 2.2.4
PHP 5.2.1
MySQL 5.0.27

I've tried this many times but each time is the same problem. Install 5.1 get to the intro page, create an account.. access denied.

I cant login with any account, even if i create a new one, the same behavior with that account (all accounts even uid 1)

I've tried various fixes... adding things to settings.php sessions.inc user.modules, tables in the database. I've cleared cookies, cache, tables. Nothing seems to work.

If you want to test to see what i'm talking about here is the URL: https://courses.washington.edu:444/pove/

Like i've said there are a lot of threads around and everyone thinks they have the difinitive fix for the problem but none have worked for me.

Does anyone have any idea how to get this thing to login? I'd really like to have this install "functional" by this weekend to start configuring and working on a template design.

Any help is greatly appreciated.

Comments

Plecebo’s picture

Suggestions? Anything?

Should I be filing a bug? How do I figure out where the trouble lies? What should I do? I'm happy to troubleshoot but am at the end of my ability to do so... I need help from the community.

ganges’s picture

Feel the same pain :(

It is look like Drupal skip one of the installation step where You receive "admin" login and the auto-generated password. It really sad :(

Additional notes to the peole, who can help with this

I use MySql database as root without password on Linux (Mandriva) and Apache 2.03But DB connection goes well - account created but instead of "admin" fulfilment in reg area i receive "root"

Definitely something goes wrong or with my soft configuration or with Drupal installation process.
Please, help

Plecebo’s picture

I figured out my problem.

I was 100% sure that I had already checked this, but apparently I either did not comment out the lines correctly or some other problem because this fixed it.

I commented out the following lines in my settings.php files:

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);
  }
}

That fixed my problem, probably because of my goofy URL.

menneke’s picture

Yes! That did the trick!
I had been scratching my head and cross-eying over gazillion google results to solve this (I'm a total noob), until I found and tried this suggestion. Everything is fine now.

Thank you, thank you, thank you.

cycas’s picture

Same here. I really could kiss you. I was on the point of throwing my laptop out of the window and starting a new career as a bottlewasher.

I would have sworn I already tried commenting this out as well: I had seriously got to the stage where I was going through all the fixes I'd tried and trying them again to check I'd done them right...

I am now wondering if there is another thread floating about here that suggests commenting out something that looks very similar, but ain't. There does seem to be quite a lot of confusion on this topic, and most threads seem to cover several related issues.

The specific problem I had, that was solved by commenting out the code you give above, was with a brand new clean install of Drupal 5.1: I did the install and could create users and receive the passwords by email, but was unable to get any further, as all pages gave an 'access denied' message and none of the admin menu links were showing.

I was installing on Pair Networks, in case anyone else out there is struggling with this - they give you a weird default URL of something along the lines of www123.pair.com/name456 .

As I was only using that one URL to get things up and running I had assumed that the stuff about multiple addresses / domains didn't apply to me, but it appears that this problem does still occur if you only have one URL, if the format of that URL is non-standard.

robsteranium’s picture

I experienced:
You don't have permission to access / on this server

I am now able to create the first user account after declaring my base URL in settings.php to my server address ccgi.***.com/drupal-5.1

pfahlr’s picture

Editing this seems to work because the source code does not account for particular URLs. I installed on a development machine with a url of the from xxx.xxxx.xxx.xxx:[PORT]. The regular expression did not make an acceptable domain name out of my mutant version of $_SERVER['HTTP_HOST']. I had noticed earlier that when I attempted to log in with an erroneous password, I would receive an error. When I used the correct password, I posted and was redirected to the "Access Denied" page. I checked the cookies and Drupal had set none, but obviously the password check completed successfully. I commented out the entire section. Apparently there was no reason to run ini_set(). If Drupal is not setting a cookie, but your login is behaving the way I described, try commenting out this section. If that doesn't work, I bet setting $domain = [your domain name]; will.

pelikan2402’s picture

MY Solution:Close your Zone Alarm
clear/erase your previous UID#1 user in phpmyadmin (not UID#0)
go to: create your first account
fill in the user and everything
it should work now. but if you get an error page, just click back<0 button and it will popup an account/edit page.

Plecebo’s picture

Is it possible that the URL for the site is causing problems? My URL is:

https://courses.washington.edu:444/pove

is it possible that the https OR the 444 are messing with the login session?

Maybe something like you log in and send the information from https but the login credentials are not saved appropriately or are returned via http instead of https?

Maybe drupal is having trouble connecting via a port rather then the standard port?

I'm grasping at straws, hoping someone can help me figure out what is going on.

The goofy url is only temporary (a new test server that will be going live in two weeks), after that the https and the :444 go away and the url will become http://courses.washington.edu/pove

Anyone?

psysta’s picture

Hi everybody,

same problem here, but I have uncommented the lines dealing with the domain cookies (?) as told, in the settings.php file, but nothing changed.
I create the first account. I receive the confirmation email with the password.
When I try to log in, Drupal won't let me in.

System:
Drupal 5.1
Apache 2.0.54
PHP 5.0.4
MySQL 4.1.12

Thanks a lot for your response.

Regards,
Henri

rbaarsma’s picture

I had a working version of my site on http://www.mysite.com.
Then I wanted to move my server and test it on a subdomain, in this case http://jail.mysite.com.
When i tried to login on jail.mysite.com/user it gave me the weird access denied error.

After reading this post and the comment in the settings.php source I changed the following lines in this piece of code

/**
 * 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);
  }
}

$domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
to
$domain = '.'. preg_replace('`^jail.`', '', $_SERVER['HTTP_HOST']);

This worked for me.

Note that just uncommenting the lines of code did not work for me.

jacko762’s picture

Hy, iv tried commenting the things out in settings.php. None of this worked... Iv tried looking for all kinds of things that might be wrong. Im lost on what to do. can anyone help? I still get Access Denied....

jacko762’s picture

Now when it sends me a new password for the main admin i click the link and it takes me to http://drupal.lionzone.com/?q=user/password... heres where its supposed to be taking me http://drupal.lionzone.com/?q=user/reset/1/1182196543/91339015be22896138...

what am i doing wrong?

iv tried everything i can think of from all the threads... iv been having this problem for several days now and i cant get past it. iv even tried reinstalling it multiple times. today i reinstalled it... logged out and it would not let me log back in... so im at a loss of words on where to go from here...

all of this is with drupal 5.1

can anyone help me? i would greatly appreciate it!

rbaarsma’s picture

Instead of uncommenting the lines of code, activate them and change this:

$domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
==>
$domain = '.'. preg_replace('`^[a-z]+.`', '', $_SERVER['HTTP_HOST']);

This will get you the following lines of code:
/**
* 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('`^[a-z]+.`', '', $_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);
  }
}

See if it works, it does for me;)

jacko762’s picture

That didnt work for me... so i dont know what to do... im gonna try and get 4.7 up and running and if later if you all get this fixed then i will upgrade. thanks for everyones help!!!

all-reits’s picture

Like many, I spend a lot of time wondering what was so special to my problem and why all the solutions and other suggestions didn't work.
I did a fresh install of Drupal 5.1, PHP 5.2.1 in my test server (localhost) and i couldn't get it going.
Finaly this tread leaded me in the derection to look at my cookie settings of my browser.
I use Safari 3.02 (beta). Afer I changed the settings to: "Accept cookies always", I logged in like a charme....

Good luck!

Spinuzzi’s picture

I, too, have spent 12 hours reading through the posts and applying all sorts of patches, fixes, etc., to no avail. I finally ran across a post mentioning Zone Alarm and felt like an idiot - I have had similar problems with ZA before. SO - when I turn off ZA the login problem goes away! I have sent an inquiry to ZA tech help on the issue, but in the mean time I think the problem is with how Drupal sets cookise. If you are having this problem go look at your browsers cookies for your Drupal install. Ypu will most likely find TWO cookies set: the original cookie and a followup cookie to OK your passworded login. The original cookie HAS HAD ITS CONTENT DELETED, but is STILL THERE! Yesterday I logged in 5 times and got 5 'wrong password' screens. However, my Drupal install showed 5 users logged in with my user ID! So login is occurring, but the firewall is apparent ly allowing only info from the first cookie to be seen by Drupal (or something like this...).
Drupal needs to DELETE the original cookie, instead of just deleting the content. Fact is, I had to turn off ZA just to log in here at the forums due to the same problem. I can also login here or on my Drupal install with ZA running if I first go delete the empty cookie!!

likewhoa’s picture

I'm having the same kind of issue but only when trying to log the user out, login the user in works fine, it's just when the user tries to navigate to the index.php?q=logout that the
"Access denied
You are not authorized to access this page."

message comes up. my specs are.

Gentoo Linux kernel 2.6.20
php-5.2.3
lighttpd-1.4.15
mysql-5.0.38

again, only manually deleting my browser cookies lets me logout.

Bending technology to fit business

catacaustic’s picture

I had the same issues with not being able to log in. It was a fresh install on a new server running PHP 5. I installed Drupal 5.1 as that's what I was using on my dev box here, and I could not log in using any browser that I tried, and all of the "fixes" on here gave me no joy at all.

All I had to do was kill off the version that I installed and do a fresh install of Drupal 5.2 as it was out now that was shown on the homepage when I came to find out what the problem was with this.

All I can say is that Drupal 5.2 works fine, so if you're having issues with this, I'd suggest upgrading. The worst it can do is get a newer version with the same problems.