How to enter data into the session for a longer time?

Just started the introduction session) Write it in the following way. Data is used in the personal Cabinet.

$userId = User::checkUserData($email, $password);

public static function auth($userId)
 $_SESSION['user'] = $userId;

The first time after entering the personal Cabinet, all works perfectly. But after about 30 minutes of use the personal Cabinet, the following occurs: javascrtipt on the page works successfully, but user not saved in the database.

Only after reboot it becomes apparent that an error occurred and the data entered by the user is not preserved. Tell me how to avoid such mistakes? How to extend session time, so that the user can open the same page through the day (if you have not closed the browser) and to enter data without re-entry to the personal account? Or somewhere need to save session data? I will be grateful for the answer =)
April 3rd 20 at 17:44
1 answer
April 3rd 20 at 17:46
The standard session lifetime 24 minutes.
Change the settings session.gc_maxlifetime in php.ini and restart the server.
Similar question on stackoverflow.

Find more questions by tags PHP