Open bin/magento in your preferred file editor and add the following line and save:
ini_set('display_errors', 1); // allow PHP errors reporting
Run the command again:
php bin/magento list
it will show error which the cause cli not run
I used the below commands and it solves my issue every time.
php -f bin/magento setup:upgrade
rm -rf pub/static/*
rm -rf var/view_preprocessed/*
php -f bin/magento setup:static-content:deploy
php -f bin/magento cache:clean
php -f bin/magento indexer:reindex
chmod 777 -R html
Finally I got solution. Just I enabled cron_consumers_runner from app/etc/env.php. Default cron_consumers_runner is false, Just i changed true.
'cron_consumers_runner' => [
'cron_run' => true,
'max_messages' => 10000,
'consumers' => [
Connect to your web server using ssh
Locate your current PHP CLI path by run command:
On my ubuntu server, the output is:
Open crontab setting by run command:
The crontab is just like a text file, every line is a job will run with a schedule.
The part 45 3 * * * is time schedule. That says the script ...
This does not accomplish OP's goal of utilizing the Magento CLI, however it does work for usage in automation which is what OP (and myself) was looking to achieve.
If your automation has access to the database, we can set the theme by querying the appropriate tables and performing INSERT statements.
Set Theme at a global scope:
INSERT INTO ...