Ajax请求不续订会话?

On my website, when user is logged in, there is an AJAX request going on every ~20seconds, the requested PHP is working with sesssion (starts with session_start).

I thought that having the website opened + the "infinite" ajax requesting should keep the logged-in user logged-in.

However I got an echo from one of my users, that he gets logged-out after a longer while - how is this possible? Isn't ajax request respectively the requested PHP renewing the Session?

What might cause these logg-outs?

Thanks in advance.

Try putting something like this in your header

<?php
ini_set('session.gc_maxlifetime', 60 * 60); //ini_set('session.gc_maxlifetime', Mulpitplyer*Seconds);
session_start();
?>

Sessions can also drop off if the user has an "unstable" internet conection

According to this post, it could be because the browser is caching AJAX requests which could be resolved by including a $.ajaxSetup({ cache: false }) call before your request.