Reputation: 3089
I have web based on symfony 3. For deploy i have own bash script. In this script are routines like git pull, clear cache...
On server is: Debian GNU/Linux 9 (stretch)
But after deploy i can see exception in prod.log
:
[2018-05-11 16:55:36] request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The directory "/var/www/domain.com/var/cache/prod/annotations" is not writable." at /var/www/domain.com/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php line 92 {"exception":"[object] (InvalidArgumentException(code: 0): The directory \"/var/www/domain.com/var/cache/prod/annotations\" is not writable. at /var/www/domain.com/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php:92)"} []
But problem is - before and after clear cache i have command chmod -R 777 /var
and after deploy if i look to /var/cache/prod/annotations i see new files with time of change equals time when i run clear cache (via sh script).
Anybody some ideas? Where look what chceck?
Upvotes: 0
Views: 1696
Reputation: 12128
This error occurs if your shell writes into app/cache
first and then you open your website where other parts should be written to that folder too.
Simple solution: add your shell user to the group that your webserver uses, probably www-data
, through sudo usermod -a -G www-data userName
Upvotes: 1
Reputation: 514
The problem is the permissions, to fix use this:
setfacl -R -m u:www-data:rX folderProject
setfacl -R -m u:www-data:rwX folderProject/var/cache folderProject/var/logs folderProject/var/sessions folderProject/app/sessions
setfacl -dR -m u:www-data:rwX folderProject/var/cache folderProject/var/logs folderProject/var/sessions folderProject/app/sessions
Replace folderProject with your project name. If you are using Ubuntu with apache this command fix the problem, if you are using another GNU/Linux change the user www-data to your user
Upvotes: 0