0
votes

I am using codeigniter php framework now in developing backend web application. But session is often expired. My config.php(application/config/ folder) is ;

  $config['sess_driver'] = 'files';
    $config['sess_cookie_name'] = 'ci_session';
    $config['sess_expiration'] = 0;
    $config['sess_save_path'] = NULL;
    $config['sess_match_ip'] = FALSE;
    $config['sess_time_to_update'] = 300;
    $config['sess_regenerate_destroy'] = TRUE;

In codeigniter guide, $config['sess_expiration'] = 0 -> "maintains session until the browser is closed .".

By the way, in my web application, when the user does nothing for a little time (about 30 mins), session is expired, so users must login again.

What shall I set in config.php?

2
You may have to make an adjustment to the php.ini file, as the default is 24 minutes (1440 seconds). If you are going through a hosting company, they might have a different setting.cfnerd
Also you have not set your save path.Mr. ED

2 Answers

0
votes

Try it working for me..

Just add $config['sess_expire_on_close'] = TRUE;.

    $config['sess_driver'] = 'files';
    $config['sess_cookie_name'] = 'ci_session';
    $config['sess_expiration'] = 0;
    $config['sess_save_path'] = NULL;
    $config['sess_match_ip'] = FALSE;
    $config['sess_time_to_update'] = 300;
    $config['sess_regenerate_destroy'] = TRUE;
    $config['sess_expire_on_close'] = TRUE;
0
votes

This problem is related to the php.ini file.

In php.ini file, I could find this line.

session.gc_maxlifetime=1440

This value is second unit, and 24 minutes later, session is auto closed.

So I solved this problem by setting this value a large number.

Thank you for your time.