dev-labs-bg / sportify

Football match prediction game with simple rules, built on Symfony
GNU Affero General Public License v3.0
33 stars 13 forks source link

"The directory "/var/www/html/var/cache/prod/annotations" is not writable." error after clearing cahce #38

Closed aminvakil closed 5 years ago

aminvakil commented 5 years ago

I changed some of the code and used php bin/console cache:clear --env=prod to clear cache in order to see my changes in production mode, but the website was giving me 500 error afterwards.

I checked apache2 error logs and saw this:

PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/html/var/cache/prod/annotations" is not writable.

So I checked /var/www/html/var/cache/prod and saw that prod folder and its subfolders are all owned by root and this caused by executing php bin/console cache:clear --env=prod by root user, therefore I changed owner of the folder and its subfolders using this command chown -R www-data: /var/www/html/var/cache/prod (change www-data to your own apache user if you need to) and everything went fine.