database connection error


I have the Yii Framework in which I have made 2 more files like commons.php and env.php. commons.php is taken for modules and env.php is taken for database connection. Here I have used Cmap::mergeArray() to merge all the array.

I have used it like this


// change the following paths if necessary



// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);








in env.php I have made database connection.So this is the code part


return array(

    // uncomment the following to use a MySQL database


      'connectionString' => 'mysql:host=localhost;dbname=ia_databasename',

      'emulatePrepare'   => true,

      'username'         => 'XXX',

      'password'         => 'XXX',

      'charset'          => 'utf8', 

      'TablePrefix'      => 'ia_',




But after all this whenever I am going to login to my application through user/login, it is showing error like

CDbConnection failed to open the DB connection: could not find driver 

Why it is behaving like this? Please help me to solve this…

This might help you :

It’s impossible to help you since you haven’t posted what’s in ‘env.php’ - you can change the actual username/password, but we need to see what you are doing in it. ;)