从yii2-basic运行控制台作业

I want to run a cron job in yii2-basic for that we are create controller in commands folder that is :-

<?php
 namespace app\commands;
 use yii\console\Controller;
 class IndexController extends Controller
 {
   public function actionIndex()
   {
     echo "message ";
   }
}

and when run this commands in terminal php yii index/index its working correctly but when I add this code in index function :-

    $checkblogsql=TblBlog::find()->all();
    $totalblogcount=count($checkblogsql); 

its showing error :-

    Exception 'yii\db\Exception' with message 'could not find driver'

    invar/www/html/ameborcam/vendor/yiisoft/yii2/db/Connection.php:550

my db connectivity is correct becaouse Main site is working correctly. Thank you

Your CLI (console) PHP is probably different from CGI (web) PHP. You can check current CLI PHP version by running in console

php -v

If this is the case you must configure your CLI PHP with proper database modules so database driver can be used.

For currently installed CLI modules run

php -m