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

I am working on Windows 7 and MYsql

and this is my first time to use yii.

when i try to access Model generator i have this error

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

please i need help very quickly

When generate project structure by yii command, did you change db connection in protected/config before access model generator ?

yes i change the configuration in main.php to my database name,password,username

What does the requirement script say?

Make sure that you have installed the necessary php extensions.

The error says it all really, it cannot make the connection to your database because it cannot find the database driver. Either install the missing driver, or you may have the connectionID configured incorrectly in the config file…

I am using sqlite. I had same error. I uncommented line: extension=php_pdo_sqlite.dll in file php.ini.

Be sure to restart your web server (Apache) after doing this to reload the configuration/driver(s).

Also check this line of code in main.php


			'connectionString' => '[b]mysql[/b]:host=localhost;dbname=lms',

I had this same problem and found this thread… here’s what my problem was

My PHP installed & configured this by default >>

extension=php_sqlite.dll

Yii wants this

extension=php_pdo_sqlite.dll

Best

I had that trouble once, just install the correct connector :

For Mysql

sudo apt-get install php5-mysql

For SQlite

sudo apt-get install php5-sqlite