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?

Technocracker
2,0371 gold badge15 silver badges26 bronze badges
asked Aug 9, 2016 at 15:19

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.

answered Aug 10, 2016 at 5:11
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

answered Aug 9, 2016 at 16:25
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 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();
}
}
?>
answered May 2, 2020 at 17:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.