How to install module magento 2 don't need run command line bin/magento setup:upgrade
I think system() function will be your friend, if you don't have permission of CLI.
To use this function , just simple create new file in your root server(Let's call it custom.php
), then write below code in this file
system('php bin/magento cache:status');
// you can change it to your command
And run this script with http://your base url/custom.php
It will gives you resulted output.
You have also second option if you run magento2 command without CLI , but it doesn't gives you any message(I mean success or fail), but you can use if you don't have any option.
For that you have to create a new file(Let's call it custom1.php
), and write below code in your file.
<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
$k[0]='bin/magento';
$k[1]='cache:status'; // write your proper command like setup:upgrade,cache:enable etc...
$_SERVER['argv']=$k;
try {
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);
$application = new Magento\Framework\Console\Cli('Magento CLI');
$application->run();
} catch (\Exception $e) {
while ($e) {
echo $e->getMessage();
echo $e->getTraceAsString();
echo "\n\n";
$e = $e->getPrevious();
}
}
And run this script with http://your base url/custom1.php
I know this is very dirty way, but you can use if you want.