Question: For the header of every page of my login-ed section, I added the following codes to maintain the session:

```
session_set_cookie_params(1200, '/mysystem');
session_start();

```

My intention is, I set the session lifetime to 1200 seconds, with path `/mysystem` via the function [session\_set\_cookie\_params()](http://php.net/manual/en/function.session-set-cookie-params.php). The reason using this function is to separate the session cookie with other PHP scripts in same domain, e.g. <http://www.example.com/another_system/>

The problem is, the session expires when 1200 seconds is reached, no matter there are activities ( such as load another page under `/mysystem` , or refresh the page .

Expected behavior: The session "countdown" resets when page activity is made when active session is valid.

What did I miss ?

Answer: 
This is how it works. The cookie is set once, after that it starts counting down. To solve this, you have to reset the cookie with a new expiration date, every time the user interacts with the backend.
you can try time() function to update the cookie expire time..

try to add time() function in every page , get the current page loaded time and make it expire 

by $expireTime = time()+1200;

```
      <?php

          session_set_cookie_params($expireTime, '/mysystem');
          session_start()
       ?>

```