I have purchased a hosting which supports magento 2. I use cpanel to create DB and upload files and installed it successfully. Am trying to learn module creation by this tutorial...
http://inchoo.net/magento-2/how-to-create-a-basic-module-in-magento-2/
When i encounter the following line...
php bin/magento setup:upgrade
which was supposed to be executed via commandline for the new module to get registered... i struckup.... from the very beginning i did not use commandline for anything here and am not comfortable with that too. Just wondering if there is a alternate way in magento to enable a custom module that i develop.
Note: the hosting i have doesnot offer ssh access so there is no way i can browse to that page and run that command.
Pls help me understand this... am new to magento development...
2 Answers 2
<?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');
$key[0]='bin/magento';
$key[1]='cache:status';
$_SERVER['argv']=$key;
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();
}
}
Run the script from magento root folder.
-
I tried this but resulting me a blank page... does not works for me !user2301765– user23017652017年07月04日 05:10:46 +00:00Commented Jul 4, 2017 at 5:10
Magento 2 relies heavily on cli usage and does not play well with a shared hosting. It will make your life really difficult.
You could try adding a php file with this content
<?php
shell_exec('php bin/magento setup:upgrade');
but I doubt it will work. Most probably, if you don't have ssh access, then shell_exec is disabled also.
You could try the answer from Jothibasu. It might work, but this will help you for now.
In order to have a proper magento website you will need to run a cron (you might be able to do that without ssh access though).
But the cli will save you a lot of trouble.
-
i tried this not working...user2301765– user23017652017年07月04日 05:11:07 +00:00Commented Jul 4, 2017 at 5:11