DB connection: could not find driver

Hi Guys!

i have a problem…

DB connection: could not find driver

i must install my mamp new and i had update the yii-framework.

and now, my shell tool dosn't work…

i checked:

  • chmod of yiic files

  • the php cli-version

  • yii-requirements (PDO-Drivers : OK)

      Memcache Erweiterung  Verfehlt  CMemCache   

      APC Erweiterung Verfehlt CApcCache

  • path to yii-framework & apps

  • the database- and tablenames

i can create a new application via console.

next i set my mysql-connection in the main.php






at next, i want to create model 'User'


cd path/to/app/

% php protected/yiic.php shell


% php -c path/to/php.ini protected/yiic.php shell

-> DB connection: could not find driver

what is wrong?!? - need help - please!!!

You also need pdo_mysql extension.

i have found it!

my php.ini file have no rights…

i change the rights and ist works on mac

Wait, what rights? I am having this problem now. It works on my ubuntu box at home, but it doesn’t work on the MAMP server here at work. I had to dig into CDbConnection to even get the error message, but it’s the same error, ‘driver not found’. Did you have to change a directive in php.ini or did you have to change perms associated with the file itself?


Try to open console and run next command: php -m

This will show list of installed modules, if it doesn’t show you pdo_mysql, then you need to install it.

Maybe you fixed this already, but I ran into the same problem. So this is for users running into the same error.

I used the default cache component like:

'cache' => array(

	'class' => 'system.caching.CDbCache',


This creates a sqlite db, that also needs PDO. PDO for sqlite is SEPERATE from PDO_MYSQL.

So check if you have caching enabled and if so, check if it is going to a sqlite db.

Thanks a lot, was having a hard time figuring out why it couldn’t connect to the database, even if pdo_mysql was installed.

I had the same problem, for me it was the CDbHttpSession class. I’ve had to add connectionID parameter to get an informative error message. (The table was missing on my new environment)