Hello,
I’m reading the yii book and I’m stuck in the chapter 8.
I’m getting an error when I try to run a rbac script.
this is the error.
>> rbac
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in /Users/adrian/Sites/yiiRoot/framework/db/CDbConnection.php:382
Stack trace:
#0 /Users/adrian/Sites/yiiRoot/framework/db/CDbConnection.php(331): CDbConnection->open()
#1 /Users/adrian/Sites/yiiRoot/framework/db/CDbConnection.php(309): CDbConnection->setActive(true)
#2 /Users/adrian/Sites/yiiRoot/framework/base/CModule.php(388): CDbConnection->init()
#3 /Users/adrian/Sites/yiiRoot/framework/web/auth/CDbAuthManager.php(586): CModule->getComponent('db')
#4 /Users/adrian/Sites/yiiRoot/framework/web/auth/CDbAuthManager.php(60): CDbAuthManager->getDbConnection()
#5 /Users/adrian/Sites/yiiRoot/framework/base/CModule.php(388): CDbAuthManager->init()
#6 /Users/adrian/Sites/yiiRoot/framework/base/CModule.php(104): CModule->getComponent('authManager')
#7 /Users/adrian/Sites/trackstar/protected/commands/shell/RbacCommand.php(21): CModule->__get('authManager')
#8 /Users/adrian/Sites/yiiRoot/framework/cli/commands/ShellCommand.php(130): RbacCommand->run(Array)
#9 /Users/adrian/Sites/yiiRoot/framework/cli/commands/ShellCommand.php(101): ShellCommand->runShell()
#10 /Users/adrian/Sites/yiiRoot/framework/console/CConsoleCommandRunner.php(65): ShellCommand->run(Array)
#11 /Users/adrian/Sites/yiiRoot/framework/console/CConsoleApplication.php(91): CConsoleCommandRunner->run(Array)
#12 /Users/adrian/Sites/yiiRoot/framework/base/CApplication.php(162): CConsoleApplication->processRequest()
#13 /Users/adrian/Sites/yiiRoot/framework/yiic.php(33): CApplication->run()
#14 /Users/adrian/Sites/trackstar/protected/yiic.php(7): require_once('/Users/adrian/S...')
#15 /Users/adrian/Sites/trackstar/protected/yiic(4): require_once('/Users/adrian/S...')
#16 {main}
I’m using Yii 1.10 version. I use MAMP as well.
This is my code on config/main.php config/console.php
'db'=>array(
'class' => 'CDbConnection',
'connectionString' => 'mysql:host=127.0.0.1;dbname=trackstar_dev;',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
),
'authManager'=>array(
'class'=>'CDbAuthManager',
'connectionID'=>'db',
),
I read some post but I got the same error.
I tried:
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
Change localhost to 127.0.0.1
please any help.
thanks,
Adrian