Solving Drupal 6 Login Problem in PHP
If users are unable to log into an existing Drupal 6 site after upgrading PHP, then the following steps may help resolve the issue.
==========
1. In the Drupal folder, open the file that handles the user sessions.
includes/session.inc
2. Find the sess_regenerate() function and add the lines marked "After PHP upgrade" as follows.
// BEGIN CODE
/**
* Called when an anonymous user becomes authenticated or vice-versa.
*/
function sess_regenerate() {
global $user; //After PHP upgrade
$old_session_id = session_id();
// ...
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
$temp = $user; //After PHP upgrade
session_regenerate_id();
$user = $temp; //After PHP upgrade
db_query("UPDATE {sessions} SET sid = '%s' WHERE sid = '%s'", session_id(), $old_session_id);
}
// END CODE
3. Save the file, reload the page and log in.
==========
Comments
Post a Comment