Create the command file and put the command script into that file on the Magento root directory. Then execute that script using browser Url.
Upgrade command script
<?php
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$logger = $obj->get('PsrLogLoggerInterface');
try{
$logger->info("upgrade start");
echo passthru('php -d memory_limit=1G bin/magento setup:upgrade');
$logger->info("upgrade finished");
}
catch(Exception $e){
$logger->info("upgrade not working");
}
?>
di.comple command script
<?php
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$logger = $obj->get('PsrLogLoggerInterface');
try{
$logger->info("compile start");
echo passthru('php -d memory_limit=1G bin/magento setup:di:compile');
$logger->info("compile finished");
}
catch(Exception $e){
$logger->info("compile not working");
}
?>
Deploy command script
<?php
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$logger = $obj->get('PsrLogLoggerInterface');
try{
$logger->info("compile start");
echo passthru('php -d memory_limit=1G bin/magento setup:static-content:deploy');
$logger->info("deploy finished");
}
catch(Exception $e){
$logger->info("deploy not working");
}
?>
Indexer command script
<?php
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$logger = $obj->get('PsrLogLoggerInterface');
try{
$logger->info("indexing start");
echo passthru('php -d memory_limit=1G bin/magento indexer:reindex');
$logger->info("indexing finished");
}
catch(Exception $e){
$logger->info("indexing not working");
}
?>
Cache Flush command script
<?php
use MagentoFrameworkAppBootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$logger = $obj->get('PsrLogLoggerInterface');
try{
$logger->info("cache start");
echo passthru('php -d memory_limit=1G bin/magento cache:flush');
$logger->info("cache finished");
}
catch(Exception $e){
$logger->info("cache not working");
}
?>

