Artisan: Could not find driver
Asked Answered
L

4

5

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()

enter image description here

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

Lowermost answered 3/6, 2012 at 17:52 Comment(0)
L
5

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.

Lowermost answered 5/6, 2012 at 0:7 Comment(2)
You can add PATH:$PATH:/opt/lampp/bin to your .xinitrc if you so desire.Taddeo
Using XAMPP PHP would solve the issue. I guess you should have also specified how to use the XAMPP PHP. Different Linux versions have different files in which PATH is to be edited. If you are unable to find the which file you need to edit, skip it. Just give the XAMPP PHP path while running artisan i.e. /opt/lampp/bin/php artisan migrate:installInfliction
T
13

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

sudo apt-get install php5-mysql

And then it worked.

Tahmosh answered 23/9, 2012 at 16:31 Comment(0)
L
5

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.

Lowermost answered 5/6, 2012 at 0:7 Comment(2)
You can add PATH:$PATH:/opt/lampp/bin to your .xinitrc if you so desire.Taddeo
Using XAMPP PHP would solve the issue. I guess you should have also specified how to use the XAMPP PHP. Different Linux versions have different files in which PATH is to be edited. If you are unable to find the which file you need to edit, skip it. Just give the XAMPP PHP path while running artisan i.e. /opt/lampp/bin/php artisan migrate:installInfliction
K
4

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.

Krilov answered 4/6, 2012 at 2:27 Comment(0)
B
0

probably it's because you did not install extension mysql

sudo apt-get install php-mysql
Bailor answered 8/6, 2018 at 14:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.