CodeIgniter Forums
session keeps expiring - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: session keeps expiring (/showthread.php?tid=48994)

Pages: 1 2


session keeps expiring - El Forum - 02-04-2012

[eluser]keevitaja[/eluser]
i'm having problem with ci session expiring. maybe after 5 minutes or so. anyone has an idea why it is doing that?

Code:
$config['sess_cookie_name']  = 'ci_session';
$config['sess_expiration']  = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name']  = 'ci_sessions';
$config['sess_match_ip']  = TRUE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update'] = 300;



session keeps expiring - El Forum - 02-04-2012

[eluser]vbsaltydog[/eluser]
Quote:
Code:
$config['sess_match_ip']  = TRUE;

Is your ISP changing your IP address?


session keeps expiring - El Forum - 02-04-2012

[eluser]InsiteFX[/eluser]
Raise this value up:
Code:
$config['sess_time_to_update'] = 600;  // 600 = 10 minutes - 300 = 5 minutes

Also make sure your session table is correct!
Code:
-- ------------------------------------------------------------------------

--
-- Table structure for CodeIgniter `ci_sessions`.
--
DROP TABLE IF EXISTS `ci_sessions`;

CREATE TABLE IF NOT EXISTS  `ci_sessions` (
  `session_id`    varchar(40)           DEFAULT '0' NOT NULL,
  `ip_address`    varchar(16)           DEFAULT '0' NOT NULL,
  `user_agent`    varchar(120)                      NOT NULL,
  `last_activity` int(10)      unsigned DEFAULT 0   NOT NULL,
  `user_data`     text,
  PRIMARY KEY (`session_id`),
  KEY `last_activity_idx` (`last_activity`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;

-- ------------------------------------------------------------------------
--  `user_data` text,       COMMENT - maximum length of 65535 characters.
--  `user_data` mediumtext, COMMENT - maximum length of 16777215 characters.
--  `user_data` longtext,   COMMENT - maximum length of 4294967295 characters.
-- ------------------------------------------------------------------------



session keeps expiring - El Forum - 02-05-2012

[eluser]keevitaja[/eluser]
ip is not changing. i have same fenomenon on the local and public machine. mysql table is ok. and update time set to 600. still session expiring.

any thoughts?


session keeps expiring - El Forum - 02-05-2012

[eluser]Bhashkar Yadav[/eluser]
@InsiteFX :

can it be due to session setting into php.ini like session.gc_maxlifetime value.
I 'm not sure if CI manages session setting by own.
please share you thoughts.


session keeps expiring - El Forum - 02-05-2012

[eluser]keevitaja[/eluser]
changing session.gc_maxlifetime doesn't help.

i'll try fresh ci installation...


session keeps expiring - El Forum - 02-05-2012

[eluser]vbsaltydog[/eluser]
Code:
phpinfo();



session keeps expiring - El Forum - 02-05-2012

[eluser]keevitaja[/eluser]
http://dl.dropbox.com/u/60672885/phpinfo.pdf

not sure if it helps. session keep expiring on zone.ee web hosting as well...

my site is http://lu.ee


session keeps expiring - El Forum - 02-05-2012

[eluser]keevitaja[/eluser]
ok, session is alived according to

$config['sess_time_to_update'] = 3;

on CI fresh install. after specified time session_id is renewed. where did i go wrong or is it supposed to do that?


session keeps expiring - El Forum - 02-05-2012

[eluser]InsiteFX[/eluser]
@Bhashkar

It is possible, but I have always seen it set to a default.

It almost sounds like he is getting a session_destroy someplace.

This is what my php.ini session stuff is set to:
Code:
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440