Hi,

I have drupal 4.6.6 on apache server, on php 4 it worked without any problems, but after upgrade to php 5, I can't login. I checked the sessions database table and each time I click login button a new record is added, but no cookies are set(session id must be in the cookie, right?). What might be the problem?

Thanks in advance.

Comments

cmsproducer’s picture

You properly diagnosed the problem. I had exactly the same issue a few months ago and instead of copying the story here, I will direct you to a review that I did, and the solution that worked for me.

http://www.cmsproducer.com/node/13

-----
iDonny - Web CMS Development, Design, and Web Marketing Advice

heine’s picture

Perhaps it's just me, and I don't want to offend you, but is that the correct link? The story linked to doesn't really make (complete) sense with regards to OP's question... Unless you want to suggest to return to PHP 4?
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

cmsproducer’s picture

Having previously mis-understood the issue, I got to research it when a customer ran into the same problem and I had to fix it.

After a good research session and looking for a solution on Drupal.org, I was able to find a solution that works for me in consistently in Drupal 4.66 and 4.7. The problem is obviously caused by an anonymous cookie string being used in the logged in session. To solve the problem, in the user.module file in the modules directory, edit the lines 947 - 954 in the user.module of Drupal version 4.7 contains the function that authenticates users and creates a $user state variable.

function user_authenticate($name, $pass) { global $user;

// Try to log in the user locally. Don't set $user unless successful.
if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) {
session_regenerate_id(); //added procedure to recreate session
$user = $account;
};

Also, you will beed to comment out the three lines preceeding this function:
-----
$old_session_id = session_id();
session_regenerate_id();
db_query("UPDATE {sessions} SET sid = '%s' WHERE sid = '%s'", session_id(), $old_session_id);
-----

By regenerating the session ID, you will drop the anonymous ID and pick a new one for the logged in session - You can see the detailed solution to this common bug by checking this Drupal resource.
-----
iDonny - Web CMS Development, Design, and Web Marketing Advice

heine’s picture

Can you check this potential solution: http://drupal.org/node/6696#comment-55263

--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

kostikberman’s picture

The problem is internet explorer bug, which is described here