Closed MuschPusch closed 9 years ago
How do you use PHP? Maybe PHP is running with the webserver user and is simply not allowed to change the permissions of the file. If you are doing it on the shell it is mostly a different thing.
Switched away from bindfs, since i don't need it anymore. So let's close this one...
I'm having the same issue using Nginx and PHP-FPM over an ubuntu guest, Mac host. Any help?
Hello. Can you post a gist with your Vagrantfile and a sample of your PHP code ?
Here's my Vagrantfile.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Throw an error if required Vagrant plugins are not installed
plugins = { 'vagrant-bindfs' => nil }
plugins.each do |plugin, version|
unless Vagrant.has_plugin? plugin
error = "The '#{plugin}' plugin is not installed! Try running:\nvagrant plugin install #{plugin}"
error += " --plugin-version #{version}" if version
raise error
end
end
# You can ask for more memory and cores when creating your Vagrant machine:
# VAGRANT_MEMORY=2048 VAGRANT_CORES=4 vagrant up
MEMORY = ENV['VAGRANT_MEMORY'] || '1024'
CORES = ENV['VAGRANT_CORES'] || '2'
# Determine if we need to forward ports
FORWARD = ENV['GITLAB_VAGRANT_FORWARD'] || '1'
Vagrant.configure("2") do |config|
config.vm.hostname = "ssp-dev"
config.vm.box = "ubuntu/trusty64"
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
config.vm.network :private_network, ip: "192.168.3.4"
if FORWARD.to_i > 0
config.vm.network :forwarded_port, guest: 3306, host: 3336
config.vm.network :forwarded_port, guest: 80, host: 8000
end
# Remove the default Vagrant directory sync
config.vm.synced_folder ".", "/vagrant", disabled: true
# Sync the 'vagrant' directory on the host to /gitlab on guest
# Use NFS on Linux/OS X and SMB on Windows
config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
if Vagrant::Util::Platform.windows?
config.vm.synced_folder ".", "/vagrant", create: true
config.vm.synced_folder "../app", "/var/www", create: true
else
config.vm.synced_folder ".", "/vagrant-nfs", :create => true, :nfs => true
config.bindfs.bind_folder "/vagrant-nfs", "/vagrant", :owner => "vagrant", :group => "vagrant", :'create-as-user' => true, :perms => "u=rwx:g=rwx:o=rD", :'create-with-perms' => "u=rwx:g=rwx:o=rD", :'chown-ignore' => true, :'chgrp-ignore' => true, :'chmod-ignore' => true
config.vm.synced_folder "../app", "/www-nfs", :create => true, :nfs => true
config.bindfs.bind_folder "/www-nfs", "/var/www", :owner => "vagrant", :group => "www-data", :'create-as-user' => true, :perms => "u=rwx:g=rwx:o=rD", :'create-with-perms' => "u=rwx:g=rwx:o=rD", :'chown-ignore' => true, :'chgrp-ignore' => true, :'chmod-ignore' => true
end
config.vm.provider :virtualbox do |v|
# Use VBoxManage to customize the VM. For example to change memory:
v.customize ["modifyvm", :id, "--memory", MEMORY.to_i]
v.customize ["modifyvm", :id, "--cpus", CORES.to_i]
if CORES.to_i > 1
v.customize ["modifyvm", :id, "--ioapic", "on"]
end
end
# Provision with shell
config.vm.provision :shell, path: "bootstrap.sh"
end
The error is not happening within my app code. It's happening within Symfony's cache code. If I run a command (such as cache:clear) it works ok. However, when running from the web server, it fails.
Originally, I set Nginx and PHP-FPM to run with the www-data user. Then, I made www-data group the main group for the user vagrant (the one I use when I ssh). The permissions are set with a 022 umask, so anyone with group www-data would be able to write.
As a workaround, I have changed both Nginx and PHP-FPM to run as vagrant. This works, but it's not an elegant solution.
Thanks!
After reading the chmod
function footnotes in the PHP documentation, I don't think this is a bindfs or vagrant-bindfs problem but a normal behavior of PHP.
I added the following lines to my Vagrantfile
I use bindfs since i have an application which needs to change the permission on the shared folder. When doing a command line:
$ chmod 775 platforms # works
When php -> chmod is triggering the change i get an Operation not permitted