When everything seems fine but login just doesn't log you in...
The Problem
Your Drupal site seems fine. Maybe it worked yesterday. Maybe it's working right now on another environment. But you just can't log in. You enter the right username and password. Drupal doesn't report an unrecognized username or password. But it's just not logging you in.
The Solution
PHP 5.6 introduced a change that impacts Drupal's use of the $_SESSION variable. Drop this code into a module to fix the problem.
<?php
/**
* hook_user_login(). Fix a bug in PHP session handling.
*
* See https://www.drupal.org/node/2363219
*/
function YOUR_MODULE_user_login(&$edit, $account) {
// print __FUNCTION__; die;
if( substr( phpversion(), 0, 3 ) === '5.6' ) :
$_SESSION['mymodule']['ulogged'] = 1;
endif;
}
?>
Leave a comment