Vagrant vm + apache permission is forbidden for mkdir ()

I use vagrant to run my vm using ubuntu, apache, etc. This runs on my OSX host.

Everything works fine until my php application tries to create a folder, files in that folder, etc. I am not allowed. What am I missing in the provision / configuration of a stray file?

+6
source share
3 answers

in this case, if you are using Vagrant + Apache2.

decision:

  • change / etc / apache 2 / apache2.conf;
  • Find the User and Group Directives
  • Change these lines to:

    User vagrant Group vagrant 
  • run sudo apache2 restart ;

it cannot be changed / owner of the roaming directory on www-data (apache user);

Anyway, this works for me.

+20
source

Change Vagrantfile

  config.vm.synced_folder "./", "/var/www", owner: "www-data", group: "www-data" 
+3
source

You need to set the owner in the folder that php is trying to write to, the apache user, which is usually www-data ... ssh, in the field of tramps and try:

 sudo chown www-data:www-data <dirname> 

This should work ... if it is, just add this to what ever creator you are using.

+1
source

Source: https://habr.com/ru/post/945156/


All Articles