When you use PHP sessions for your applications, the sessions have a specific period of time that they remain active for when idle. The session time is restored when you are active though.
Applications timing out too quick and asking you to login again because the PHP session has expired can be frustrating.
Increase the PHP session lifetime to stay logged in longer.
The PHP directive is
session.gc_maxlifetime and there are several ways of setting it depending on your server setup:
Via PHP Code
You can try to use
ini_set('session.gc_maxlifetime', 3600); in your application before
session_start(); is called.
Your hosting control panel may provide you with a PHP configuration editor where you can set the PHP directive to increase the PHP session time accordingly.
Ask Your Hosting Provider
If you don’t manage with this, best will be to ask your hosting provider or server administrator. They will know what to do.
I would like to extend the session timeout in phpI know that it is possible to do so by modifying the php.ini file.But I don’t have access to it.So is it possible to do it only with php code?