Can someone explain exactly how to make the session to last for longer in PHP, but without using php.ini?
I've tried the following in .htaccess:
<IfModule mod_php5.c>
#Session timeout
php_value session.cookie_lifetime 3600
php_value session.gc_maxlifetime 3600
</IfModule>
I've also tried:
ini_set('session.gc_maxlifetime', '3600');
But none of them seem to be working.
Any idea?
gc_maxlifetime and session. The superglobal variable $_COOKIE array has been used here to handle the session. The new session will be generated for the user when the script will execute in the browser and after two seconds the session will be expired.
Session timeout can be customized, to make the user's page inactive after a fixed time. Starting session: The PHP, session_start() function is used to start a session in the web page.
Defaults to 1440 (24 minutes). Note: If different scripts have different values of session. gc_maxlifetime but share the same place for storing the session data then the script with the minimum value will be cleaning the data.
Ok - I've found the way and it works - in the .htaccess I simply added the following to increase the timeout to 5 hours:
php_value session.cookie_lifetime 18000
php_value session.gc_maxlifetime 18000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With