Laravel 5 Session Lifetime

Check your php.ini for:

session.gc_maxlifetime - Default 1440 secs - 24 mins

session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. Garbage collection may occur during session start (depending on session.gc_probability and session.gc_divisor).

session.cookie_lifetime - Default 0

session.cookie_lifetime specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed." Defaults to 0. See also session_get_cookie_params() and session_set_cookie_params().

In case it is less time than the Laravel configuration, the cookie will be removed because the local php.ini have preference over Laravel configuration.

You can just increase it or comment/delete.

In case is not solved something on your App is destroying the session.

UPDATE

After release v5.5.22 session lifetime is loaded from .env and is not hardcoded anymore at config/session.php, changes there.

Now you can modify the session lifetime using:

SESSION_LIFETIME=

In your .env file.


Change .env file in your app root

SESSION_LIFETIME=120

And value is in minutes.


I found lifetime settings on this place in one project...

bootstrap/cache/config.php

so I need to run first

php artisan config:clear