After making a change to app/etc/di.xml

Am I required to take some additional steps in order for the change to take effect?

Like clean cache, deploy static files or compile code?

  • yes sure, please run clean cache and deploy static files.
    – MGento
    Sep 25, 2017 at 9:58
  • 2
    Why you modify here [app/etc/di.xml] ?
    – Sohel Rana
    Sep 25, 2017 at 10:00

4 Answers 4


Yes, you need to recompile after you have done some changes in di.xml file and then it's a good practice to remove cache too.

php bin/magento setup:di:compile

A nice answer is here for your reference. Hope it will give you a better idea.

  • @PrincePatel it's my pleasure. Sep 25, 2017 at 10:11

This is also possible through the Admin UI.

  1. Go to: System > Cache Management
  2. Check "Configuration" in the table
  3. In the dropdown over the table choose "Refresh" and click "Submit".

Just do a php bin/magento setup:upgrade, it will clean all caches and remove generated folders as well.


You can also remove the folders inside the var/ like

  • generation
  • cache
  • page_cahceapart from.htaccess` file

Then run the command php bin/magento c:f,

  • The question has specific case scenario. Your suggestion will remove not only every cache type which is not necessary, but when you remove whole generation directory, it is mandatory to run di:compile when Magento is not in developer mode.
    – dudzio
    Apr 18 at 8:36

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.