-1

I want to switch to production mode but I can not find information about the exact commands that I have to use. I know that I must use this command:

php bin/magento deploy:mode:set production

But, do I need to make some change of permission for the folders? Do I need to execute some more command before or after using the command to change to production mode?

UPDATE

These are the commands I use to give permissions to my Magento files and folders:

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data .
chmod u+x bin/magento
3
  • 1
    Directly run this command. No need to change any permission or other command. Commented Jun 11, 2019 at 9:13
  • php bin/magento deploy:mode:set production --skip-compilation Commented Jun 11, 2019 at 9:52
  • The folder permissions that I use are the ones that I have added in my question. Are those correct for developer mode and production mode?
    – Despotars
    Commented Jun 11, 2019 at 9:56

2 Answers 2

4

You can use this command to set production mode:

bin/magento deploy:mode:set production

Note: If you are going to switch from Developer to Production mode two actions must first be taken.

1) Static Deploy (bin/magento setup:static-content:deploy)

2) Compilation (bin/magento setup:di:compile)

8
  • ok and what is the commands for do this?
    – Despotars
    Commented Jun 11, 2019 at 10:29
  • 1
    @Despotars I have updated the answer. Commented Jun 11, 2019 at 10:32
  • 1
    @Despotars Yes that's correct. Commented Jun 11, 2019 at 11:10
  • 1
    Yes, first you have to switch any default or developer mode by using this command bin/magento deploy:mode:set default/developer after that you can install the any modules. Commented Jun 12, 2019 at 12:26
  • 1
    You can add product/category in production mode but after adding any changes you must to run deploy command (bin/magento setup:static-content:deploy) Commented Jun 12, 2019 at 13:54
2

You only need to run this command, to switch to production mode

php bin/magento deploy:mode:set production

In case, you get blank screen, You should run

php bin/magento setup:upgrade

then

php bin/magento setup:static-content:deploy

then

php bin/magento indexer:reindex

That's enough!

4
  • I don't think so we need upgrade, deploy and reindex in order to change mode alone, each of these have specific functionality in it. So it doesn't require mate Commented Jun 11, 2019 at 9:37
  • The folder permissions that I use are the ones that I have added in my question. Are those correct for developer mode and production mode?
    – Despotars
    Commented Jun 11, 2019 at 9:39
  • @PrathapGunasekaran, yes you are right. it's only required if there is blank screen after production mode set. i have to run these commands after i switch to production mode whenever i get blank white screen
    – Khushbu
    Commented Jun 11, 2019 at 10:01
  • 1
    @Khushbu.... yes it worked for me Commented Mar 11, 2020 at 4:58

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.