I regularly get this error message:
1 exception(s): Exception #0 (Exception): Warning: file_put_contents(/var/www/html/magento/var/cache//mage-tags/mage---365_COMPILED_CONFIG): failed to open stream: Permission denied in /var/www/html/magento/vendor/colinmollenhour/cache-backend-file/File.php on line 663
To fix it, I remove the cache :
rm -rf var/cache/* var/di/* var/generation/* var/page_cache/* var/view_preprocessed/* pub/static/frontend/*
But it always comes back regularly, although I've set the permissions for two users in development mode :
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
sudo chown -R :www-data .
chmod u+x bin/magento
Even after cleaning the cache this way :
rm -rf var/cache/* var/di/* var/generation/* var/page_cache/* var/view_preprocessed/* pub/static/frontend/*
php bin/magento cache:clean
php bin/magento setup:upgrade
php bin/magento setup:di:compile
Is it a bug with Magento 2.2 or did I miss something ?
php
running aswww-data
??chown -R :www-data var/cache/mage-tags
to resolve the issue. It still reoccurs each time a condition from my original post happens.