I'm new to Magento 2 and have successfully deployed magento 2.4.1 with apache on Kubernetes. However, I'm facing issues with product images not being displayed when I mount pub/media using cosfs. The following errors are encountered:
[2023-05-22 08:48:53] main.CRITICAL: Directory "/var/www/html/pub/media" cannot be created Warning!mkdir(): File exists {"exception":"[object] (Magento\\Framework\\Exception\\FileSystemException(code: 0): Directory \"/var/www/html/pub/media\" cannot be created Warning!mkdir(): File exists at /var/www/html/vendor/magento/framework/Filesystem/Driver/File.php:236)"} []
The main reason for this issue is that the mount user is set as root, and I am unable to change it because I used Tencent's web interface for mounting.
Here are the results of the folder permissions when listing them:
I am starting Apache with the www-data user.
Could you provide any advice or suggestions on how to fix this issue? I would greatly appreciate any help you can offer.
Hello @zolzayaern23fd
Giving full control (read/write/execute) to the var and pub directory will resolve this issue.
Note: Run this command from your Magento project root folder.
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9