CDbConnection failed to open the DB connection: could not find driver in D:\xampp\htdocs\ilmversity\framework\db\CDbConnection.php:382 in yii1

70
April 07, 2021, at 05:20 AM

I am working on a project using yii1.1 with MySQL database, Db is connected and working fine, but when I run the Migration command in protected folder through CMD it gives the error as mentioned in the headline, I have tried but on my system, it doesn't work but on the other machine, with the same settings, it works fine, Whereas the code is the same on both systems. I have tried every possible solution available on StackOverflow but it didn't work. The Error stack is below:

CDbException: CDbConnection failed to open the DB connection: could not find driver in D:\xampp\htdocs\ilmversity\framework\db\CDbConnection.php:382 Stack trace: #0 D:\xampp\htdocs\ilmversity\framework\db\CDbConnection.php(330): CDbConnection->open() #1 D:\xampp\htdocs\ilmversity\framework\db\CDbConnection.php(308): CDbConnection->setActive(true) #2 D:\xampp\htdocs\ilmversity\framework\base\CModule.php(387): CDbConnection->init() #3 D:\xampp\htdocs\ilmversity\framework\base\CModule.php(118): CModule->getComponent('applicationdb') #4 D:\xampp\htdocs\ilmversity\protected\models\AltSettings.php(33): CModule->__isset('applicationdb') #5 D:\xampp\htdocs\ilmversity\framework\db\ar\CActiveRecord.php(1428): AltSettings->getDbConnection() #6 D:\xampp\htdocs\ilmversity\framework\db\ar\CActiveRecord.php(1518): CActiveRecord->getTableAlias(true) #7 D:\xampp\htdocs\ilmversity\protected\models\AltSettings.php(131): CActiveRecord->findByAttributes(Array) #8 D:\xampp\htdocs\ilmversity\protected\models\AltSettings.php(159): AltSettings::getSettingValue('instance_status') #9 D:\xampp\htdocs\ilmversity\protected\commands\DbMigrationCommand.php(23): AltSettings->getApplicationDbName() #10 [internal function]: DbMigrationCommand->actionMigrate(1) #11 D:\xampp\htdocs\ilmversity\framework\console\CConsoleCommand.php(172): ReflectionMethod->invokeArgs(Object(DbMigrationCommand), Array) #12 D:\xampp\htdocs\ilmversity\framework\console\CConsoleCommandRunner.php(71): CConsoleCommand->run(Array) #13 D:\xampp\htdocs\ilmversity\framework\console\CConsoleApplication.php(92): CConsoleCommandRunner->run(Array) #14 D:\xampp\htdocs\ilmversity\framework\base\CApplication.php(180): CConsoleApplication->processRequest() #15 D:\xampp\htdocs\ilmversity\framework\yiic.php(33): CApplication->run() #16 D:\xampp\htdocs\ilmversity\protected\yiic.php(7): require_once('D:\xampp\htdocs...') #17 {main}

Console.php file is as follow

'db'=>array(
        'connectionString' => 'mysql:host=hostname;dbname=db_name',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
    ),
    'db2name'=>array(
        'class' => 'CDbConnection',
        'connectionString' => 'mysql:host=hostname;dbname=db_name',
        'emulatePrepare' => true,
        'username' => 'username',
        'password' => 'password',
        'charset' => 'utf8',
    ),

I have also mentioned the following code in the main.php config folder,

    'db'=>array(
        'connectionString' => 'mysql:host=hostname;dbname=testdrive',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
    ),

I have also seen drivers in the config file extension=mysqli (and extension=pdo-mysql) are not preceded by semi colons.

READ ALSO
JavaScript execution works on Chrome and not WordPress

JavaScript execution works on Chrome and not WordPress

I am running this code in Chrome console dev tools and it works:

30
Rows until a number reaches zero [Python]

Rows until a number reaches zero [Python]

I've been trying to find a solution to this problem for days, to no availOur warehouse asked for a way to calculate how many days it takes to process the incoming items, according to our forecast

61
My notification is sent only when I start the app on some devices

My notification is sent only when I start the app on some devices

I have developed a notification that is sent every time a BroadcastReceiver is woken up by an AlarmMaganerWhen the receiver shows the notification it also takes care of activating the next notification

50