If i update any modules or disable extensions my website showing an error message, i do following all the commands then coming back to normal,

  1. rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*

  2. php bin/magento setup:di:compile

  3. php bin/magento setup:static-content:deploy -f // (-f for Development Mode)

  4. php bin/magento cache:flush

  5. Give permission

Time to complete a minimum of 5 minutes, during that time my website showing error message like

  1. Permission related issue
  2. Static files related issue

How to overcome this issue in the Production Mode?

3 Answers 3


This is related to your server configuration. You can set a default permission for new files and directories on your server.

Use the umask command to set the default permission.

If you want to set 777 permission for all the directories, run the following commands from the root directory of Magento

umask 0000

After running this command, whenever a new directory is created, it will assign 777 permission by default.

Please visit the following URL to get more idea about this command and how it works.


Note: It is not recommended to set the 777 permission by default. Once the development phase is over, make sure to revert the permissions for Magento files and directories as shown here : https://magento.stackexchange.com/a/95033/48571

  • Now my website production mode.
    – zus
    Commented Sep 29, 2020 at 5:21
  • If your website is in the production mode, then do not set the default permission. Instead, set the permission manually after running your commands. Commented Sep 29, 2020 at 6:14
  • Now i do the same job, during running the commands my website shows an error message on the website to the customers, how to handle this issue?
    – zus
    Commented Sep 29, 2020 at 6:17
  • You have to update the ACL configuration on your server for setting the default permission on a specific directory. Commented Sep 29, 2020 at 6:44

You can check the owner of the files,
If it is the current user or not. Check if below is the case.

$ ls -l /var/www/html/magento/
total 8 
drwxr-xr-x 2 sujit sujit 4096 Feb 21 23:39 ./ 
drwxr-x--- 5 rohan nobody 4096 Feb 22 02:28 ../ 

So below command can help:

sudo chown -R myuser:mygroup <flile/directory name>


On a very basic level what I used to do is to keep 2 magento connected to same database. Run the commands on the one that is not connected to your domain currently, while the other folder remains untouched and live traffic doesn't feel anything. When you completely execute all the commands than u can either rename the folder names so that live domain can point to the magento folder in which you have run all the commands.

Off course you have to keep your media folder up to date manually or best approach in that case scenario is to create a subdomain for static contents so that you don't have to keep track of more than one media media folder.

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.