Codeigniter session expires quickly

Asked

Viewed 302 times

2

I made a control panel for a customer and in this panel my client can edit the products of the site. After the customer Edit a product and click on Save, When the client will try to edit more fields the system redirects to the login page, that is, the session expires, because when there is no session the system redirects to the login page. Sometimes the client navigating the control panel, in just over 2 minutes it redirects to the login page. Below the file session settings application/config.php

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

2 answers

1

In the configuration file there is a part to configure the session variables.

In this part you find the configuration

$config['sess_expiration']

This variable is used to set the time, in seconds, that your session should last. Set this variable to zero and the session will last until the browser closes.

0

Try setting the session to a very large number instead of using zero. Try:

time()+(3600*24*365*5)

or

time()+157680000;

This session should last about 5 years.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.