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?


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

| improve this answer | |
  • If it's solved ur issue. Then please accept the answer. Thanks a lot :) – Jackson Nov 30 '16 at 1:23

You can create a ssh script - deploy.sh

-MAGENTO path to Magento root folder
-MAGENTOBIN path to Magento bin folder

Our script deploy.sh

MAGENTO = /home/magentoroot

chmod -R 775 $MAGENTO/var $MAGENTO/pub

rm -rf $MAGENTO/var/view_preprocessed $MAGENTO/var/di
rm -rf $MAGENTO/pub/static/adminhtml $MAGENTO/pub/static/frontend $MAGENTO/pub/static/_requirejs

php $MAGENTOBIN setup:upgrade
php $MAGENTOBIN setup:di:compile
php $MAGENTOBIN setup:static-content:deploy
php $MAGENTOBIN indexer:reindex
php $MAGENTOBIN cache:flush
| improve this answer | |

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.