Saturday, March 11, 2017

Lavarel 5.2 Session File dropping

I'm having a big trouble with Laravel that I cannot fix. Sometimes my login session in my App drops randomly. Here is my config/session.php file:

<?php

return [
    'driver' => env('SESSION_DRIVER', 'file'),
    'lifetime' => 300,
    'expire_on_close' => false,
    'encrypt' => true,
    'files' => storage_path('framework/sessions'),
    'connection' => null,
    'table' => 'sessions',
    'lottery' => [2, 100],
    'cookie' => 'laravel_session',
    'path' => '/',
    'domain' => null,
    'secure' => false,
    'http_only' => true,
];

It is expected to work for several minutes after login (session being set) but I have cases which it drops after 5 minutes. The login is customized and I use the session setter like this:

Session::put("admin",$admin);

I have read that the problem might be with file read/write concurrency? I find a bit awkward because there is only one machine using that login.

EDIT: before asking, all my routes are inside middleware Web.



via Diogo Mendonça

Advertisement