I'm having a really really bad time with laravel sessions (4.2) in one project. Every reload it generates a bunch of session files (case it's configured to file), or database rows (aprox. 20 rows/files per request) and I can't figure it out why. Here are the actions I've taken to try to solve this:
1)I've checked my php.ini and the session.gc_maxlifetime is 1440.
2)I've checked that there are no early printing in the scripts.
3)I've checked that composer dump-autoload does not solve the problem.
4)I've checked that native PHP sessions are fine and persisting.
5)I've used laravel migration to generate the session table (so it's not a problem with column types).
6)I've deleted my vendor folder and lock file and performed a composer install.
The thing is, I went home yesterday and pulled a new laravel project and the sessions were working just fine. What the heck can be happening?
To clarify, I have a controller with an action:
public function getIndex()
{
var_dump(Session::getId());
Session::save();
session_start();
var_dump(session_id());
die('die');
}
It prints:
string '4505ed48069f6c468c5d3a3c1c6e6094db8d989d' (length=40)
string 'b24gbst01gdulo77o4utfq6id2' (length=26)
die
When refreshed the php native session id is kept, but laravel id is different every time.
This is my laravel session.php:
'driver' => 'file',
'lifetime' => 120,
'expire_on_close' => false,
'files' => storage_path().'/sessions',
'connection' => 'mysql',
'table' => 'sessions',
'lottery' => array(1, 1000),
'cookie' => 'laravel_session',
'path' => '/',
'domain' => 'mydomain',
'secure' => false,
Any hints?