laravel 工匠:找不到驱动程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10872606/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Artisan: Could not find driver
提问by Gerep
I'm using Laravel last version: 3.2.1.
我正在使用 Laravel 的最新版本:3.2.1。
When I run this on terminal:
当我在终端上运行它时:
php artisan migration:install
php artisan migration:install
I have this error:
我有这个错误:
could not find driver
could not find driver
I made some searches on Google and on Laravel's Forum, nothing.
我在 Google 和 Laravel 的论坛上进行了一些搜索,但一无所获。
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.
我已经激活了扩展程序,这就是我所拥有的phpinfo()
--with-iconv' '--with-pdo-mysql=mysqlnd' '--with-pdo-pgsql=/opt/lampp/postgresql' '--with-pdo
看起来我的 pdo 已设置。
Here is an image of my phpinfo()
这是我的图片 phpinfo()
EDIT 2I've made a little test:
编辑 2我做了一个小测试:
<?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
所以我的 PDO 运行良好
采纳答案by Gerep
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.
问题是我的电脑有另一个版本的 PHP 而我没有使用 XAMPP PHP,sugin XAMPP PHP 解决了这个问题。
回答by Branimir Kolar
On Ubuntu 12.04 all I had to do was to install php5-mysql:
在 Ubuntu 12.04 上,我所要做的就是安装 php5-mysql:
sudo apt-get install php5-mysql
And then it worked.
然后它起作用了。
回答by J.T. Grimes
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.
这不是 Laravel 错误,而是 PDO 问题。很有可能,您的 php.ini 文件没有加载您使用的任何数据库驱动程序所需的扩展名。
回答by Diego Santa Cruz Mendezú
probably it's because you did not install extension mysql
可能是因为你没有安装扩展mysql
sudo apt-get install php-mysql