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?
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.