If I read that function correctly, in order to be receiving the error "Exclusive locks are not supported for this stream" you would passing true to as the third option in the "put" function call, otherwise it sets it to a 0 which is the default for no locking.
How are you calling the "put" function?
EDIT... Oh, i see it is the session driver that is calling the file put with the locking... what is your server setup you may need to use a different session driver
You could also extend the session file driver and remove the locking from it, though I am not sure what kind of problems this will cause with writing sessions.
Untested, so might need some tweaking,
In App\Providers\AppServiceProvider
Session::extend('filenolock', function($app)
{
return new FileNoLockSessionHandler();
});
New class
class FileNoLockSessionHandler extends FileSessionHandler{
/*
* override to remove file locking on session files
*/
public function write($sessionId, $data)
{
// removed last option
// $this->files->put($this->path.'/'.$sessionId, $data, true);
///
// no locking, now as default is for false is 0
$this->files->put($this->path.'/'.$sessionId, $data);
}
}
Then in config\session.php (or in the env file), set the session driver name to filenolock
Hope that helps
TerrePorter said:
You could also extend the session file driver and remove the locking from it, though I am not sure what kind of problems this will cause with writing sessions.
Untested, so might need some tweaking,
In App\Providers\AppServiceProvider
Session::extend('filenolock', function($app) { return new FileNoLockSessionHandler(); });
New class
class FileNoLockSessionHandler extends FileSessionHandler{ /* * override to remove file locking on session files */ public function write($sessionId, $data) { // removed last option // $this->files->put($this->path.'/'.$sessionId, $data, true); /// // no locking, now as default is for false is 0 $this->files->put($this->path.'/'.$sessionId, $data); } }
Then in config\session.php (or in the env file), set the session driver name to filenolock
Hope that helps
Nice! Its resolved!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community