5

Whenever I am trying to login in my Yii application it is showing error like

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

I googled many hours and from many blogs I knew that I need pdo_mysql but that is already installed. In php.ini I also made comment these lines

;extension=php_pdo_mysql.dll

;extension=php_mysql.dll

and restarted apache server but still showing the same prob. I am using ubuntu 11.04. Please help me to solve the error.

2
  • Try to check phpinfo();. You should see there PDO drivers supported. Ubuntu package php5-mysql provides necessary libraries.
    – Ostin
    Jul 13, 2011 at 7:53
  • Are you trying to connect to MySQL or another kind of database?
    – k to the z
    Jul 13, 2011 at 15:14

5 Answers 5

6

sudo apt-get install php5-mysql followed by sudo apache2ctl graceful worked for me on Ubuntu Desktop

0
0

For Ubuntu(linux), you will need to recompile Apache. Simple uncommenting will not work. In Ubuntu, I believe you can do some apt-get.

0

i dont understand why you have the first line commented, you should UNCOMMENT

extension=php_pdo_mysql.dll

it worked for me!

0

Install

sudo apt-get install php5-sqlite 

and restart the apache2

sudo service apache2 restart

its work for me.

0

First make sure you have

sudo apt install php-xml php-mbstring php-pdo php-mysql 

installed, and restart apache

sudo service apache2 restart

My solution was related to caching:

cache' => array(
    'class' => 'system.caching.CDbCache',
    //'class' => 'system.caching.CFileCache',
    'connectionID'=>'db', // <<< THIS IS THE ISSUE
),

if connectionID is not set, db caching defaults to mysqli database in /protected/data directory which cannot be accessed if mysqli driver is not installed on system (common issue with dedicated servers, DO droplets, xampp/wamp...) or, you can disable db caching and enable fileCache instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.