Which commands are needs to be executed in Magento 2


Below is the Detailed Commands which are needed to Install New Module and Clear Cache too.

Move into H:/xampp/php by comand Prompt and run all the below commands

a. php H:\xampp\htdocs\projects\servicefee\bin\magento module:enable _
– Above command adds your module to the modules list in app/etc/config.php

b. php bin H:\xampp\htdocs\projects\myproject\bin\magento setup:upgrade _
– This one really installs your module. It will basically trigger setup scripts of all Magento modules that needs setup, but if you just enabled one new module nothing else will execute except that one.

c. php h:\xampp\htdocs\projects\myproject\bin\magento cache:clean
– This will clean all the cache from the magento.

d. php h:\xampp\htdocs\projects\myproject\bin\magento setup:upgrade
– This command is used when we install any new module or we update in any database table / field we need to run this command.

e. php h:\xampp\htdocs\projects\myproject\bin\magento setup:di:compile
– This command is needed when your module is depending on other module then compile command is needed to merge all the changes.

f. php h:\xampp\htdocs\projects\myproject\bin\magento setup:flush
– This command is used to clean server cache and magento cache.

g. php h:\xampp\htdocs\projects\myproject\bin\magento indexer:reindex
– This will perform a full re index. If you wish to re index only one of the indexers, command is as follows:
php bin/magento indexer:reindex indexer_name
where indexer_name can be found by typing:
php bin/magento indexer:info