Support the ongoing development of Laravel.io →
Architecture
Last updated 2 years ago.
0

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

Last updated 9 years ago.
0

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

0

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!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.