CDbConnection error in Yii
Whenever I am trying to login in my Yii application it is showing error like
CDbConn开发者_运维百科ection 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.
sudo apt-get install php5-mysql
followed by sudo apache2ctl graceful
worked for me on Ubuntu Desktop
For Ubuntu(linux), you will need to recompile Apache. Simple uncommenting will not work. In Ubuntu, I believe you can do some apt-get.
i dont understand why you have the first line commented, you should UNCOMMENT
extension=php_pdo_mysql.dll
it worked for me!
Install
sudo apt-get install php5-sqlite
and restart the apache2
sudo service apache2 restart
its work for me.
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.
精彩评论