Magento – Magento 2 reindex, clean cache, chmod folders in 1 php script

magento2PHP

After every change I have to keep reindex, cleaning cache, and chmod 777 on var, app/etc and pub everytime. Is there any php script out there that can do all of this? Or an easier method that running the commands 1 by 1?

Best Answer

U can make shell script on Linux Server named for example mage.sh which contains following commands

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cache:flush
chmod -R 777 var pub
rm -rf var/cache/* var/generation/* var/di/*

when u have to run just go to ur root folder on command line & run ./mage.sh & ur job will be done.

As per need of your command u can make script & run

Related Topic