0

I can't use ACL, so I've tried to add umask(0000) to the app/console and web/app.php in my VPS, but the permissions of app/cache are turned again to 0755 and owner group to myFTPUser when I clear cache, so my site throws an error until I change permissions again to 0775 and group owner to www-data:

php app/console cache:clear --env=prod --no-debug
chown -R myFTPUser:www-data app/cache/
find app/cache/ -type d | xargs chmod -R 0775
find app/cache/* -type f | xargs chmod -R 0664

The only way I've found out is to change user to Apache user before clear cache, without changing umask:

su www-data
php app/console cache:clear --env=prod --no-debug

And now it works right without doing anything else. But, is it the right way to go? and, why Symfony2 documentation doesn't clarify this point?

Manolo
  • 24,020
  • 20
  • 85
  • 130

1 Answers1

0

You will have to run this command from the apache user.

If this is a development environment then it's not a bad thing to set the user to your own user. However in a production environment you would more than likely just have to switch to the apache user.

Seer
  • 5,226
  • 5
  • 33
  • 55
  • *in a production environment you would more than likely just have to switch to the apache user.* What is the difference between running this command from Apache user and setting the owner to Apache user? I guess there is not any difference. – Manolo Dec 18 '13 at 07:43
  • That isn't a difference, those are both of the requirements of doing this. You want to have the directory owned by the Apache user so that your application functions correctly, and you want to run commands from the Apache user because they will only work that way too. This is how I work with this problem at least. – Seer Dec 19 '13 at 19:18