for some reason that I can't figure out my Laravel install has started created a new session file on every request! This renders the session useless and so I users can't stay logged in, csrf tokens don't match etc.
I'm using Laravel 5.2. It seems fine on my local environment but not on the live server
Does anyone have any clues on why this might have happened and how I can resolve it?
Thanks in advance
Laravel utilize basically the original session file store but acts a little bit different. Beside changing the directory they are saved, when you call the regenerate function it creates another session file and deletes the old one. You can see it the implementation Illuminate\Session\Store. php .
Sessions are used to store information about the user across the requests. Laravel provides various drivers like file, cookie, apc, array, Memcached, Redis, and database to handle session data. By default, file driver is used because it is lightweight. Session can be configured in the file stored at config/session.
Of course each user session is unique to that logged in user.
You can create your own SessionServiceProvider , extending Illuminate\Support\ServiceProvider\SessionServiceProvider and override registerSessionDriver() in order to return a custom instance of the store class. Then comment the Illuminate\Support\ServiceProvider\SessionServiceProvider in config/app.
Locally everything worked, but not on the production server. The problem was in the php.ini settings on the hosting, by default the parameter (variable) "mbstring.func_overload = 2" was set there. I removed it and than all worked. This parameter is for previous versions (PHP) which is used by many CMS. And Laravel gave an error 419 during authorization and nothing more, and created a new session every time the page was updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With