My webserver host does not provide access to SSH.
I want to run commands like:
php bin/magento setup:static-content:deploy
I have tried to do this in the shell terminal using: - phpFileManager - eXtplorer But none of them seem to work.
When I run the command nothing happens, and there is no output to the console: Magento command no output
Can this even work in a shell, or do I need to have SSH access?
3 Answers 3
Try it :
How to install module magento 2 don't need run command line bin/magento setup:upgrade
This is not a good way but if you have not SSH then you can use it if you want.
-
Thanks for the suggestion, I will look into this and get back to you.Jonas Jensen– Jonas Jensen2016年08月10日 11:16:47 +00:00Commented Aug 10, 2016 at 11:16
Execute command localy and put genereated files from pub/* and var/* to server
-
Ok, I will try that. What about commands like "magento setup:upgrade" to update the database for modules?Jonas Jensen– Jonas Jensen2016年08月09日 17:00:17 +00:00Commented Aug 9, 2016 at 17:00
-
You can run this command in magento updater applicationKAndy– KAndy2016年08月09日 19:50:35 +00:00Commented Aug 9, 2016 at 19:50
Here is the perfect solution. Even if system() and shell_exec() and other commands are disabled from server due to security reasons, this script will help you to execute commands.
Note : It will not give any output but it will execute the command successfully.
<?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]='setup:upgrade'; // You can change command as you want like setup:static-content:deploy, cache:status 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();
}
}
?>