0

I'm having a problem with getting a shell command to clear a specific product cache because the permissions in the cache folder are strictly restricted to www-data. For example, folder /var/cache/mage--a files are like these:

-rw-------  1 www-data www-data 7646 Mar  4 11:20 mage---c54_PRODUCT_CACHE_123
-rw-------  1 www-data www-data  184 Mar  4 11:20 mage---internal-metadatas---c54_PRODUCT_CACHE_123

So when the shell command runs, it calls Mage::app()->cleanCache('PRODUCT_CACHE_123'), which triggers down to _fileGetContents function defined in lib/Zend/Cache/Backend/File.php and it's unable to open the meta file in /var/cache/mage--a due to the permissions listed above.

Does anyone have a suggested fix for this?

3
  • 1
    Which user executes the shell command? Let the user www-data execute the shell command or root.
    – HelgeB
    Mar 4, 2019 at 20:23
  • What do you have when you enter whoami ?
    – PЯINCƎ
    Mar 4, 2019 at 20:33
  • @HelgeB thanks for the suggestion, the shell command is run by cron so i believe it's not www-data Mar 4, 2019 at 21:44

1 Answer 1

0

I ended up using Redis for caches instead. This helped solve the problem as i don't need to set up file permissions for the cache folder anymore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.