1

When i try to Flush catalog images cache i get the following error

The file "/home/shaffersuiting/public_html/project/pub/media/catalog/product/cache/1/swatch_image/30x20/beff4985b56e3afdbeabfc89641a4582/i/n/inqalab_final_colour_08.jpg" cannot be deleted Warning!unlink(/home/shaffersuiting/public_html/project/pub/media/catalog/product/cache/1/swatch_image/30x20/beff4985b56e3afdbeabfc89641a4582/i/n/inqalab_final_colour_08.jpg): Permission denied

All my folders/files have 775 permission

Help required urgently

0

Check permissions and ownership of this exact file:

/home/shaffersuiting/public_html/project/pub/media/catalog/product/cache/1/swatch_image/30x20/beff4985b56e3afdbeabfc89641a4582/i/n/inqalab_final_colour_08.jpg

Try deleting it manually and clearing image cache again.

It you can't delete it manually, I presume 2 situation might have caused such behaviour:

  1. you deployed static files with root privilages - so all files in your /pub/ folder have root owner and can't be deleted by the Magento file system owner.

  2. Your web server is missconfigured so the Magento file system owner doesn't have write permissions on these files - in this situation as a quick fix you'd need to give 777 permission to all your files, which is a bad idea overall.

The 1st situation is more likely, so you'd need to run:

sudo chown file_system_owner:file_system_owner /home/shaffersuiting/public_html/project/pub/ -R

Where "file_system_owner" is the owner of Magento root.

  • I can delete them manually, but when i refresh the folder from Cpanel they appear again ... any thoughts on that? – Mahib Bukhari Jan 13 '18 at 21:03
  • That's just a visual bug in cpanel. You didn't actually delete the file, since you don't have permissions to do so. If you have access to the command line, you should try the command I mentioned. – Lez Jan 13 '18 at 21:06
  • I did it and now i'm getting this errorFatal error: Uncaught Zend_Cache_Exception: cache_dir "/home/shaffersuiting/public_html/project/var/page_cache" is not writable in /home/shaffersuiting/public_html/project/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0 – Mahib Bukhari Jan 13 '18 at 21:08
  • Fixed ... i defined the wrong user name in command ... after changing it with right user name the issue is resolved ... Thanks – Mahib Bukhari Jan 13 '18 at 21:35
  • No problem, glad I could help – Lez Jan 13 '18 at 21:36
0

It is happened due to permission issue. change the permission by using below command.

sudo chmod -R 777 .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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