I had created a custom script which update my database. After completion of database update, I want to execute the Magento CLI commands by adding custom functions in my custom script.

The script should run commands as below:

1) setup:upgrade
2) content:deploy
3) reindex
4) flush
5) 777 permissions for var/ pub/ generated/ Directories

How could I do it using a custom script in Magento 2.3.x?


Just call the terminal commands.

php bin/magento setup:upgrade
php bin/magento content:deploy
php bin/magento indexer:reindex
php bin/magento c:f
chmod -R 777 var
chmod -R 777 pub
chmod -R 777 generated
  • I know that how to run commands via custom script. But I want to run the commands using custom php script along with database update script. Dec 3 '20 at 13:00
  • 1
    why not just use shell_exec php command to run those?
    – Mark Lopez
    Dec 25 '20 at 5:18

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.