How to increase session time in codeigniter?

Member

by jerad , in category: PHP Frameworks , 2 months ago

How to increase session time in codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by wilmer.lemke , 2 months ago

@jerad 

To increase session time in CodeIgniter, you can adjust the session configuration in the config.php file located in the application/config folder of your CodeIgniter installation.


Follow these steps to increase session time:

  1. Open the config.php file in a text editor.
  2. Locate the following line of code:
1
$config['sess_expiration'] = 7200; // Default session expiration time in seconds


  1. Change the sess_expiration value to the desired session expiration time in seconds. For example, to set the session expiration time to 1 hour, you can change it to 3600:
1
$config['sess_expiration'] = 3600; // Session expiration time set to 1 hour


  1. Save the config.php file.


By increasing the session expiration time in the config.php file, you can extend the duration for which a user's session will remain active in CodeIgniter.