Artisan: Could not find driver

一世执手 提交于 2019-12-13 12:08:52

问题


I'm using Laravel last version: 3.2.1.

When I run this on terminal:

php artisan migration:install

I have this error:

could not find driver

I made some searches on Google and on Laravel's Forum, nothing.

EDIT

I have activated the extension and this is what I have on phpinfo() --with-iconv' '--with-pdo-mysql=mysqlnd' '--with-pdo-pgsql=/opt/lampp/postgresql' '--with-pdo It looks like my pdo is set.

Here is an image of my phpinfo()

EDIT 2 I've made a little test:

<?php
try {
    $dbh = new PDO("mysql:host=localhost;dbname=jjimobiliaria", "root", "");
    foreach($dbh->query('SELECT * from pdo_test') as $row) {
        print_r($row);
    }
    $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}

And the return:

Array ( [id] => 1 [0] => 1 [test_column] => TESTING!!! [1] => TESTING!!! )

So my PDO is working perfectly


回答1:


On Ubuntu 12.04 all I had to do was to install php5-mysql:

sudo apt-get install php5-mysql

And then it worked.




回答2:


The problem is that my computer had another version of PHP and I was not using the XAMPP PHP, sugin XAMPP PHP solved the problem.




回答3:


That's not a Laravel error, it's a PDO problem. Chances are, your php.ini file isn't loading the extension that you need for whichever database driver you're using.




回答4:


probably it's because you did not install extension mysql

sudo apt-get install php-mysql


来源:https://stackoverflow.com/questions/10872606/artisan-could-not-find-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!