CodeIgniter session class not working in Chrome

前端 未结 10 1572
别那么骄傲
别那么骄傲 2020-12-01 13:36

I have created a login system in codeigniter project, which is working fine in Firefox but doesn\'t work in Chrome, data fetch and set for session but when this code redirec

相关标签:
10条回答
  • just to add my experience, I'm using Codeigniter 2.1.4,

    Issue: sessions on Chrome didn't last more than a couple minutes, or get logged out while doing ajax requests. I tried several approachs: (changed sess_cookie_name, longer sess_expiration time).

    I just found that setting sess_encrypt_cookie to FALSE fixed the chrome logout issue.

    $config['sess_encrypt_cookie'] = FALSE;

    Not sure why, maybe cookie length issue on chrome (as far as I know encryption increases a lot a string length).

    I know encrypting adds an extra level of security, but as far as I've read, the data stored in the cookie is not sensitive.

    Hope it helps!

    0 讨论(0)
  • 2020-12-01 13:47

    perfect answer by Shayan Husaini I had the same problem and i resolved it by changing

    $config['sess_expiration'] = 8600;
    

    which is seconds in 24 hours, it was seconds in 2 hours

    $config['sess_expiration'] = 7200;
    

    I live in Pakistan and using server of USA so this problem pop up.

    Thanks Shayan it was great help.

    0 讨论(0)
  • 2020-12-01 13:47

    I had the same problem and I could solve the problem by changing value of $config['sess_time_to_update'] = 3; in /application/config/config.php of CodeIgniter framework.

    0 讨论(0)
  • 2020-12-01 13:49

    I changed the sess_match_useragent param to false in the config.php

    $config['sess_match_useragent'] = FALSE;
    

    And the problem with google chrome was resolved.

    0 讨论(0)
  • 2020-12-01 13:50

    Solved, CodeIgniter has some problem if the specified domain for cookies is localhost, I've set a fake domain with a real domain's name structure into the hosts file and it works.

    0 讨论(0)
  • 2020-12-01 13:50

    Check your server php version if its 7.x change to 5.6 it works for me

    0 讨论(0)
提交回复
热议问题