2

I was working on php 5.6 and use below code-

$verify_login = $this->core->verify_login($username, $password);
if ($verify_login) {
    $this->session->set_userdata("user_id", $verify_login['id']);
    $this->session->set_userdata("epost_id", $verify_login['epost_id']);
    $this->session->set_userdata("firstName", $verify_login['firstName']);
    $this->session->set_userdata("lastName", $verify_login['lastName']);
    $this->session->set_userdata("email", $verify_login['email']);
    $this->session->set_userdata("rating", $verify_login['rating']);
    $this->session->set_userdata("credits", $verify_login['credits']);

    redirect(site_url('dashboard'));
}

It was working perfectly and my session was being created. But now when I migrate to php 7.1, session is not being set due to which I am not able to log in. Any ideas? This is my config.

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 36000;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 30000;
B. Desai
  • 16,414
  • 5
  • 26
  • 47
Ali Zia
  • 3,825
  • 5
  • 29
  • 77

1 Answers1

1

For all those suffering from the same issue (CodeIgniter 3.0.6 and PHP 7.1), I got the answer. Please have a look at the following URL.

http://www.jianshu.com/p/4bf22c8af19d

Ali Zia
  • 3,825
  • 5
  • 29
  • 77
  • This page is only partially in English, and I cannot understand the parts that are not in English. In any case, best practice on SO is to include the key parts of any link in your answer. Please can you summarize the page you linked to, in English? – mpavey May 02 '18 at 19:28
  • Summary, set php.ini with these:- session.sid_length to 40; session.sid_bits_per_character to 4 and it works well for me. The second solution they proposed is to upgrade code igniter version to at least > 3.1.3. – morph85 Jan 10 '19 at 04:00