When the Magento2 site is in production mode and I want to modify some html/phtml/php/js files how can I update the edited files while remaining in production mode?
For the moment I have done this:
$ php bin/magento setup:upgrade
$ php bin/magento setup:di:compile
$ php bin/magento c:f
Finally I ran this command:
$ php bin/magento setup: static-content: deploy
When I ran the "setup: upgrade" command I saw that my files written by the production mode had already disappeared and the site did not work well.
Finally I ran the "setup: static-content: deploy" command and it returned me an error saying that it was not possible to compile the less files. Consequently I had to go back to default mode.
What could have been the mistake?
1 Answer 1
I would suggest below steps to deploy your changes on production server.
- Enabled the maintenance mode.
- Run below commands:
PHP bin/magento setup:upgrade
PHP bin/magento setup:di:compile
PHP bin/magento setup:static-content:deploy -f
If require provide correct permission for var, generated and pub folders.
If you get any error in any of the commands, you need to fix those issues on the staging server.
These are the standard Magento steps for production deployment.
Please let me know if you need any other help.
-
Thanks for this reply! One more question, for example if i want update only specific files for all stores can i ran a custom command for deploy only specific files for all store? How can i do?Jackom– Jackom2021年03月01日 12:07:08 +00:00Commented Mar 1, 2021 at 12:07
-
Support if you want to change anything in template file like phtml or block (.php) files then you need to flush the cache and you can see the changes (if there is no any other cache installed and running). If you did the changes in JS/CSS file then I would suggest running all the commands. Apart from this if you did changes in di or any etc folder file then you have to run setup:upgrade and setup:di:compile commands.Nits– Nits2021年03月01日 12:11:47 +00:00Commented Mar 1, 2021 at 12:11
-
Ok, perfect man! Thank you for now :)Jackom– Jackom2021年03月01日 12:14:41 +00:00Commented Mar 1, 2021 at 12:14
-
Explore related questions
See similar questions with these tags.