Exception 'could not find driver' while migration in yii2
Found this on Yii2
"Most likely it is your system config. If you are using packages like MAMP, XAMPP or other, you may need to change "localhost" to "127.0.0.1" in your db.php configuration file. Also if you are on Linux you may need to install some other additional packages like php5-mysql and stuff like that."
I had exactly the same error. Searching, I found a Brazilian comment regarding a similar problem caused because he had two different php version installed in his computer.
I checked the /opt/lampp/bin directory and I found two different php versions, one just plain "php" and the other "php-5.6.8", so I decided to run the second version, and it works!
test@pctest:~$ /opt/lampp/bin/php-5.6.8 /opt/lampp/htdocs/advanced/yii migrate
In my case (on Ubuntu):
sudo apt-get install php-mysql
sudo service apache2 restart
I had a similar situation during Yii2 (Advanced) migration (Xampp in Ubuntu 14.04 and PHP)
This is the message i've got:
Exception 'yii\db\Exception' with message 'could not find driver'
So after googling and reading this thread and others I found out that could be the possible problem
the PHP extension "pdo_mysql" was disabled or not installed at all
and tried this at my terminal:
php -m
after realize that the module was not there...
sudo apt-get install php5-gd php5-mysql
and after a quick install the service must be re-started...
sudo /opt/lampp/lampp restart
....finally (retry migration)
php yii migrate
Migrated up successfully.
Hope you find it useful & work for others.
I found it at ask ubuntu but i'm unable to add a link or code, since this is my first post.
link: http://www.yiiframework.com/forum/index.php/topic/49450-error-on-migrate-command-advanced-yii2-app/