lyleyboy's avatar

Exclusive locks are not supported for this stream

Hi folks,

I'm just working with my first Laravel 5 app and putting onto my 'crappy' host. Now I have several other laravel apps running on the same host and the only change I need to make is to move public to public_html. Everything else works fine.

I've pushed the site to the host at it was working fine. I did a migration and now I have an error.

ErrorException in Filesystem.php line 74: file_put_contents(): Exclusive locks are not supported for this stream

Does anyone know how I can resolve this?

I am using .env files for my environment setup. The server is running php 5.5 if that helps.

0 likes
5 replies
Approach's avatar

Try to edit your config...

'local' => [
            'driver' => 'local',
            'root'   => storage_path('app'),
        ],

to:

'local' => [
            'driver' => 'local',
            'root'   => '/tmp/',
        ],

It works well on my VM. The problem was the NFS share. Maybe the NFS protocol doesn't have this feature.

JorgeNeira's avatar

I know its an old post, but as it seems there is not a solution posted, here is what worked for me:

I had this issue today due NFS share, I'm on a windows 10 host using Homestead. I fixed by adding the 'nolock' option in Homestead/scripts/homestead.rb

So the full shared folder registration block looks like this:


    # Register All Of The Configured Shared Folders
    if settings.include? 'folders'
      settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length }
      settings["folders"].each do |folder|
        mount_opts = []

        if (folder["type"] == "nfs")
            mount_opts = folder["mount_options"] ? folder["mount_options"] : ['actimeo=1','nolock']
        elsif (folder["type"] == "smb")
            mount_opts = folder["mount_options"] ? folder["mount_options"] : ['vers=3.02', 'mfsymlinks']
        end

        # For b/w compatibility keep separate 'mount_opts', but merge with options
        options = (folder["options"] || {}).merge({ mount_options: mount_opts })

        # Double-splat (**) operator only works with symbol keys, so convert
        options.keys.each{|k| options[k.to_sym] = options.delete(k) }

        config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, **options

        # Bindfs support to fix shared folder (NFS) permission issue on Mac
        if Vagrant.has_plugin?("vagrant-bindfs")
          config.bindfs.bind_folder folder["to"], folder["to"]
        end
      end
    end

I hope it helps somebody,

JustChapman's avatar

To chime in - I just ran into this issue and just as JorgeNeira stated above, the problem is with NFS shares. But my situation might be slightly different. Just posting here to document, if someone needs it.

I'm using VirtualBox 6 on MacOS .

I ran into the issue when I brought up a new box but it did not have the VM VirtualBox Extension Pack installed, as I had installed it with a previous box. I'm not certain if VirtualBox installs the extension pack automagically when creating a new, additional box. Reinstalling the extension pack resolved the issue without config changes.

pallade's avatar

Old post, sorry, but I looked around and did not find a solution for my particular problem anywhere. In my case, it was Apparmor. You need to add a "k" permission to your storage directory and below.

In my case I have created a file called /etc/apparmor.d/local/php-fpm and I put all my overrides there.

/websites/*/root/storage/** rwk,

In Ubuntu, you will find Apparmor logs in /var/logs/audit/audit.log. I always forget to look there, when some unexpected issue arises that involves permissions...

Please or to participate in this conversation.