Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum Session Lifetime for iPad using PHP?

I have the following variables set for sessions in my PHP application:

ini_set('session.cache_expire',     200000);
ini_set('session.cache_limiter',    'none');
ini_set('session.cookie_lifetime',  94608000);
ini_set('session.gc_maxlifetime',   94608000);
ini_set('session.save_handler',     'user');
ini_set('session.use_cookies',      1);
ini_set('session.use_only_cookies', 1);
ini_set('session.use_trans_sid',    0);

When I login via my laptop (Chrome, Safari or Firefox) I am never logged out (at least not for 3 years as set above). But when I login on my iPad I am logged out every week, and sometimes multiple times per week.

I have tried using debug on my mac, deleting the cookies, inspecting the sessions cookies, etc. They all have proper expire dates (Feb 2016) but yet I am still logged out.

It seems that the iPad ignores the cookie_lifetime variable.

Anyone run into this problem before? Any ideas?

like image 903
gbtv Avatar asked Nov 13 '22 10:11

gbtv


1 Answers

Maybe this is a bug, maybe not. But I have run into the same issue as you. The workaround I used is :

session_start(); 
$lifetime = 94608000;
setcookie(session_name(),session_id(),time()+$lifetime);

Works for me.

like image 198
Jean Avatar answered Nov 15 '22 06:11

Jean