DirectoryIterator ignoring directories in vagrant synced folders

前端 未结 1 1286
一向
一向 2021-01-26 21:11

I\'m using laravel/homestead vagrant box. When I try to use DirectoryIterator for synced folder it returns only the "dot" entries (..,.

相关标签:
1条回答
  • 2021-01-26 21:28

    I had the same issue with vagrant. I debugged a little and found out the issue is the in the file type of the synced folder and not with the DirectoryIterator

    Problem

    Vagrantfile - folder sync config issue

    config.vm.synced_folder "/var/www/virtual/machine/folder", "/var/www/host/machine/folder"
    

    In the above configuration I did not specify any file type for the sync folder. because of that, Vagrant automatically choose the best synced folder option for my environment

    Solution

    I have changed the sync folder file type to "nfs" which solved the issue

    Vagrantfile - solution

    config.vm.synced_folder "/var/www/virtual/machine/folder", "/var/www/host/machine/folder", type: "nfs"
    

    Note

    Before using synced folders backed by NFS, the host machine must have nfsd installed, the NFS server daemon. This comes pre-installed on Mac OS X, and is typically a simple package install on Linux.

    0 讨论(0)
提交回复
热议问题