php - Every 15 minutes some reason session expire and redirect to login page -


i have in code not seem have affect on server. set session gc_maxlifetime time 4 hours not work. every 15 minutes redirects login page.

what can change avoid unexpected session expiration? in local works fine on server create problem.

    ini_set('session.gc_probability', 1);     ini_set('session.gc_divisor', 100);     ini_set('session.cookie_secure', false);     ini_set('session.use_only_cookies', true);     ini_set('session.gc_maxlifetime',14400);   //4 hour               setcookie("_lid", $lid, time() + 14400);      //set cokkies expiretime     $sessioncookieexpiretime=8*60*60;     session_set_cookie_params($sessioncookieexpiretime); 

the problem session garbage collection done via cronjob under /etc/cron.d/php or /etc/crontab.

this set every 30 minutes afaik.

change 0 */4 * * * let job every 4 hours.

the cronjob looks like:

09,39 *     * * *     root   [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete 

to advertise personal opinion, i'd install memcached server , use session handler. it's faster , better control without cronjob deleting files.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -