Ad

Laravel Session Cookie Expiry Changing

I am running into a problem when my Laravel session-cookie changes expiry time each time I refresh and often expires after 2x refreshes.

I think the expected functionality is for it to expire x minutes after you last interacted with the service, but mine seems to work very differently. Let me detail it:

In my Laravel .env file I have

APP_TIMEZONE="Pacific/Auckland"

Accessing PHP via the CLI I get this output with regards to my local time:

php -a
Interactive shell
php > echo date("Y-m-d H:i:s");
2018-12-30 04:08:09
php > echo date_default_timezone_get();
UTC
php > echo date('I');
0

The time given above is out by an hour. I think PHP is misconfigured for daylight savings. My cookie access times are also off by an hour as well, because of this I assume.

  1. Login (Success)

    • Expires on: Mon, 31 Dec 2018 03:53:21 GMT
    • Last accessed on: Sun, 30 Dec 2018 03:53:21 GMT
  2. Refresh #1 (Success)

    • Expires on: Sun, 30 Dec 2018 05:53:31 GMT
    • Last accessed on: Sun, 30 Dec 05:53:31 GMT
  3. Refresh #2 (Logged Out)

    • Expires on: Sun, 30 Dec 2018 05:53:39 GMT
    • Last accessed on: Sun, 30 Dec 2018 05:53:39 GMT

Here's a video of it occuring: https://youtu.be/ssPAn5aE0ME

I would have expected that my Expires on value would have been bumped forward to 24 hours ahead of when I last accessed the application (that is what my session timeout is set to).

Any help would be appreciated!

Ad

Answer

I resolved this through double and triple checking my timezone settings in my .env file and my PHP ini files.

Ad
source: stackoverflow.com
Ad