CodeIgniter Forums
How to have a session that never expires ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: How to have a session that never expires ? (/showthread.php?tid=70876)

Pages: 1 2


RE: How to have a session that never expires ? - Coool6 - 06-13-2018

(06-13-2018, 08:14 AM)dave friend Wrote:
(06-13-2018, 07:52 AM)Coool6 Wrote: I tried your solution but always the same issue, after a short time the session expires...
I don't get it  Sad Sad Sad

When you say "the session expires" you mean that the session data is gone?

I have a GitHub Repository that is designed to test CodeIgniter (v3.x.x) session configuration. It contains one controller and one view file. Give it a try it may help you determine if you have a config issue or some other "logic" problem.

When i say the session expires, i mean when the user logins, the script does that : 


PHP Code:
$this->session->set_userdata('user_id'$result['id']); 

then that to check if the logged session is still running : 

PHP Code:
if(!empty($this->session->user_id)):
echo 
"LOGGED";
endif; 

Very classic i guess, no ?

So for my test, i just login, let the tab opened and comeback X hours after, reload the page to see if i'm still logged or not. When it's 30 mins after, i'm still logged, but when it's after X hours, i'm not !

Thanks for the github, i will take a look and give it a try !


RE: How to have a session that never expires ? - Coool6 - 06-13-2018

(06-13-2018, 08:23 AM)php_rocs Wrote: @Coool6,
This probably doesn't matter but what version of PHP are you using?

PHP 7.1.13


RE: How to have a session that never expires ? - php_rocs - 06-13-2018

@Coool6 is it possible to upgrade CI to 3.1.9?
I did come across this on stackoverflow https://stackoverflow.com/questions/43718961/codeigniter-3-session-not-working-with-php-7-1-4 but I don't know if it is a similar situation because I get the impression that you are not running CI HMVC.