Magento 2 on shared hosting how to deploy static content. There is no Commend line for shared hosting Or Any other way to use Commend line.

2 Answers 2


Create a PHP script like below to execute deploy commands and execute it through the browser. Make sure to restrict this script from public access.

$command = 'cd .. && php bin/magento setup:static-content:deploy en_US --theme Magento/luma --theme Magento/backend';
exec($command, $status, $output);

echo 'Status:' . var_export($status, true).'<br>';
echo 'Output:' . var_export($output, true);

If you can setup cron from same hosting panel, you don't need ssh access. You can switch to production mode locally and than move all files to hosting.

So basically you need to work in local system and then upload files in server.

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.