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
2 Answers 2
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:
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.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– Mahib Bukhari2018年01月13日 21:03:43 +00:00Commented Jan 13, 2018 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– Lez2018年01月13日 21:06:56 +00:00Commented Jan 13, 2018 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: #0Mahib Bukhari– Mahib Bukhari2018年01月13日 21:08:59 +00:00Commented Jan 13, 2018 at 21:08
-
Fixed ... i defined the wrong user name in command ... after changing it with right user name the issue is resolved ... ThanksMahib Bukhari– Mahib Bukhari2018年01月13日 21:35:23 +00:00Commented Jan 13, 2018 at 21:35
-
It is happened due to permission issue. change the permission by using below command.
sudo chmod -R 777 .