Is there an inherent way to setup sessions to expire after a certain time. My current setup seems to be expiring after 30 minutes and I would like to disable that or at least increase it, but I can't find any places in Laravel where this could be set?
相关问题
- Laravel Option Select - Default Issue
- Data loss during sending via $_SESSION from one sc
- Chrome not keeping my _SESSION vars when coming fr
- Using a session with php and Java
- How to execute MYSQL query in laravel?
相关文章
- Page指令 的EnableSessionState="ReadOnly",怎么在web.confi
- How exactly do Firebase Analytics handle session d
- Symfony2: check whether session exists or not
- When is destructor called in a WCF service
- php : The term 'php' is not recognized as
- Laravel Eloquent, select only rows where the relat
- how to check session variable existence in MVC bef
- How Do I Seed My Database in the setupBeforeClass
App\Config\Session.php
check for lifetime...
you can also set...
Native PHP session support was dropped starting in Laravel 4.1
To configure session lifetime edit
app/config/session.php
and set the following:References:
Run
artisan changes 4.1.*
at the command line to see the note about thenative
session driver being equivalent tofile
Check your php.ini, it has a value for session.gc_maxlifetime (and also session.cookie_lifetime) that sets a limit on how long PHP will allow sessions to last. When Laravel sets the options, it passes
cookie_lifetime
as the value set inapp/config/session.php
.However, sessions are not expired immediately after the max lifetime is reached. What happens is after that amount of time has passed the session is then available to be removed by the garbage collector.
To solve the issue
One workaround is to check your
php.ini
file. You may have this variable defined:session.gc_maxlifetime
. By default it is set to 1440. Just comment or delete it.From this time on you session may work properly using your session.php config values.
In
app/config/session.php
you have:lifetime
option that allow you to set session expire time in minutes (not in seconds)
means that session will expire after an hour.
There is also one more setting here:
that decides if session will be expired when browser will be closed.
Other settings you could get interested is also
php.ini
values of:and
Those are default values.
The first one means how long session cookie will be stored - default value is 0 (until browse is closed). The second option means after how many of seconds PHP may destroy this session data.
I said may because there is one other option
session.gc_probability
inphp.ini
file that decides what's the chance of running garbage collector. Be default there is only 1% chance that after 1440 seconds (24 minutes) this session data will be destroyed.