Welcome Guest, Not a member yet? Register   Sign In
codeigniter session expires frequently
#1

[eluser]nani[/eluser]
I'm new to this forum..

I have problem with the codeigniter1.7.2 session...

these are my session settings in config file..


$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'edu_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

what my problem is even though i'm browsing the site.. user sessions expires unexpectedly irrespective of the time mentioned in the config settings.

i'm using database session to store user data..
how to fix this issue...
#2

[eluser]InsiteFX[/eluser]
The 2 lines with comments are what controls the session timings, but the session library updates with a new session_id every 5 minutes.

Code:
$config[‘sess_cookie_name’]      = ‘ci_session’;
$config[‘sess_expiration’]      = 7200;            // change this using seconds.
$config[‘sess_encrypt_cookie’]  = FALSE;
$config[‘sess_use_database’]    = TRUE;
$config[‘sess_table_name’]      = ‘edu_sessions’;
$config[‘sess_match_ip’]        = FALSE;
$config[‘sess_match_useragent’] = TRUE;
$config[‘sess_time_to_update’]  = 300;            // and this one

InsiteFX
#3

[eluser]nani[/eluser]
thank you for the post...

we can extend the session time using this setting $config[‘sess_expiration’] = 7200; .

thats fine......

if the user is ideal for some time then session expires automatically....

But what my problem is even though i'm browsing the site session expires unexpectedly.
#4

[eluser]InsiteFX[/eluser]
Well I would check to make sure that your server time is set correct, this can cause all kinds of session problems if the server time is not set correctly.

InsiteFX
#5

[eluser]nani[/eluser]
thanks
It may be the reason i have to check it but
i have this problem on my local system(localhost) also......

i found in one post that setting the

$config['time_reference'] to GMT will fix the problem but not worked for me......
#6

[eluser]Julio Fagundes[/eluser]
This happens to me too.
CI Session dont update the time of expiration when the user refreshes the page etc...
Is a countdown after session start.

But we can extend the class Session.
#7

[eluser]nani[/eluser]
hi Julio Fagundes,

Did you find any solution to this.
The problem remains same for me.....
i cant find any solution to this. i need to use db session to maintain much data in session
#8

[eluser]InsiteFX[/eluser]
If you are using the session table form the CodeIgniter User's Guide it is wrong!

Here is the correct session table, they made a change to the session table on the user_agent
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`)
) 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.
Also if you are running IE make sure the cookie name doe's not have an underscore it!

InsiteFX
#9

[eluser]nani[/eluser]
Thanks a lot. it worked..
#10

[eluser]nani[/eluser]
when i made changes to ci_sessions table it worked fine.
but now the same problem again.

Any solution for this....

help me i have to fix it...




Theme © iAndrew 2016 - Forum software by © MyBB