Category Archives: Magento2 Tutorial

These tutorial series helps you to understand the admin section of Magento 2

Run Magento 2 Command On Root Directory With PHP Script

Magento 2 command With php script

Follow below instructions to run the magento 2 commands: Create a new file on Magento 2 root directory(command.php). Add the following codes in the newly created file. <?php use Magento\Framework\App\Bootstrap; require ‘app/bootstrap.php’; $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); $state = $objectManager->get(‘Magento\Framework\App\State’); $state->setAreaCode(‘frontend’); //command code here /*shell_exec(‘your_magento_2_commands’);              –OR– system(‘your_magento_2_commands’); […]