0

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
  • 1
    Directly run this command. No need to change any permission or other command. – Sweety Masmiya Jun 11 at 9:13
  • php bin/magento deploy:mode:set production --skip-compilation – Amrit Pal Singh Jun 11 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 Jun 11 at 9:56
3

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)

  • ok and what is the commands for do this? – Despotars Jun 11 at 10:29
  • 1
    @Despotars I have updated the answer. – Faisal Sheikh Jun 11 at 10:32
  • 1
    @Despotars Yes that's correct. – Faisal Sheikh Jun 11 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. – Faisal Sheikh Jun 12 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) – Faisal Sheikh Jun 12 at 13:54
0

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!

  • 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 – Prathap Gunasekaran Jun 11 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 Jun 11 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 Jun 11 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.