0

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

1

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.

1
  • Thanks for the suggestion, I will look into this and get back to you. Commented Aug 10, 2016 at 11:16
0

Execute command localy and put genereated files from pub/* and var/* to server

2
  • Ok, I will try that. What about commands like "magento setup:upgrade" to update the database for modules? Commented Aug 9, 2016 at 17:00
  • You can run this command in magento updater application
    – KAndy
    Commented Aug 9, 2016 at 19:50
0

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();
}
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.