Application can't create a writable folder with Vagrant

I've used both WordPress and Laravel in Vagrant and set write permissions in the Vagrantfile:

config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=774','fmode=775']

And also add the default Apache user to the vagrant group (I use shell provisioning):

usermod -a -G vagrant www-data


To expand upon the answer of Jesse, when using homestead (and thus Homestead.yaml) you can pass these options through like this

folders:
- map: ./
  to: /home/vagrant/code
  options:
    mount_options: ['dmode=777','fmode=777']

Based on https://laravel.com/docs/5.8/homestead#configuring-homestead and https://www.vagrantup.com/docs/synced-folders/basic_usage.html#modifying-the-owner-group


Try adding the following line to your Vagrant file:

config.vm.synced_folder ".", "/vagrant", :group => "www-data", :mount_options => ['dmode=775','fmode=664']