How to disable "Session Expired in Laravel " in my Login Page?

Viewed 5676

I wait for 300 seconds in my login page before click the submit button Session expired appear after I click the submit button. but the expected result should be Successfully login.

Do you know how?

4 Answers

There's no "forever" option but you can set it for 20 years or so...

it can be found in

config/session.php

just change 'lifetime' => 120, to 'lifetime' => 20 * (60 * 24 * 365), for 20 years

You can't disable or There's no "forever" option but you can set it for 20 years or so

You can only set it in minutes, but it's just a basic PHP array, if you really wanted to then you could just do the basic math in it if you wanted a longer time.

Like to get an hour, multiply it by 60, to get a day multiply the hours by 24, and to get a year multiply the days by 365.

'lifetime' => 1 * (60 * 24 * 365), // 1 year

But realistically there's no point and you won't be changing this again so it'd be fine to just put the final result in the config file and leave a comment next to it to note how much the number of minutes equates to.

I dont think you can make a sessions last forever because they are meant to be expired. If your project requires a longer session lifetime, you can refer to this StackOverflow Post:

You can increase the session lifetime in config\session.php . By default it might be set to 120. Increase it to thousands to prevent session timeout.

Related