Hi everybody,
I've installed Magento 2.3 on a server running under Ubuntu, using the ubuntu user.
Magento is served by an Apache server, through the www-data user.
From what I've seen, my problem is (among others, I guess), that sometimes some folders need to be both:
If I'm not mistaken, this hapens particularly with the genetared/ folder.
Eventually, I get this kind of message in the logs:
main.CRITICAL: Warning: file_put_contents(/var/www/html/var/cache//mage-tags/mage---792_CONFIG): failed to open stream: Permission denied in ... Warning!file_put_contents(/var/www/html/generated/code/Magento/SalesRule/Model/Coupon/CodegeneratorInterfaceFactory.php.32175): failed to open stream: Permission denied Message: The specified "/var/www/html/generated/code/Magento/Downloadable/Api/Data/LinkExtension.php.5755" file couldn't be written. Warning!file_put_contents(/var/www/html/generated/code/Magento/Downloadable/Api/Data/LinkExtension.php.5755): failed to open stream: Permission denied
And so on...
Obviously, I can't set 777 permission for every folder, even if I'm running in developer mode for the moment.
So, could anybody please help me to fix the folder permissions once for all? I'm going crazy with that!
Thank you in advance
Hello @david_iux ,
Please run below commands to set the magento recommended pemissions to files and folders,
cd your -> Magento directory
find . -type f -exec chmod 644 {} \; //permission for files
find . -type d -exec chmod 755 {} \; //permission for directory
find ./var -type d -exec chmod 777 {} \; //permission for var folder
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc chmod 644 ./app/etc/*.xml
Problem solved? Click Kudos & Accept as Solution!
I just wanted to check - is this recommended by the official documentation? Just wanted to check before running those commands.
It also seems that magento 2 changes the permissions of the generated directory. For instance, in some cases there will be a permission error due to the generated folder despite it having permission changes previously.
Many thanks!
i have the same problem please help me...
[ps616574]$ find . -type f -exec chmod 644 {} \;
chmod: changing permissions of './var/.update_cronjob_status': Operation not permitted
find: `./var/backups': Permission denied
thanks and excuse me for my english is very bad
Did you already figure out how you should manage the permissions? I'm having the same problems.
SOLVED.
chmod -R 0777 var/ pub/ generated/
Hii,
if you are getting issue in compile time then please rerun compile command .
sudo php bin/magento setup:di:compile
if not solved then give below permission
sudo chmod -R 777 var/* generated/* pub/static pub/media