php artisan migration throwing [PDO Exception]找不到驱动程序-使用Laravel [英] php artisan migrate throwing [PDO Exception] Could not find driver - Using Laravel

查看:64
本文介绍了php artisan migration throwing [PDO Exception]找不到驱动程序-使用Laravel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装laravel时,我的体验很糟糕.但是,我能够这样做,并进入了新的高度.我使用生成器并创建了我的迁移. 但是当我输入最后一个命令

I have a bad experience while installing laravel. However, I was able to do so and move to the next level. I used generators and created my migrations. But when I type the last command

php artisan migrate

它抛出PDOException-找不到驱动程序.

It's throwing a PDOException - could not find driver.

       'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'unix_socket'   => '/Applications/MAMP/tmp/mysql/mysql.sock',
            'database'  => 'database',
            'username'  => 'root',
            'password'  => '',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),

这是我在config/database.php中的配置.

That's my configuration in config/database.php.

我尝试在stackoverflow和laravel论坛上进行搜索,人们认为这是PDO问题,而不是工匠或php的问题-我遵循了诸如添加

I tried searching on stackoverflow and laravel forums and people suggest that it's PDO problem and not artisan's or php's - I followed those suggestions like adding

extension=pgsql.so
extension=pdo_pgsql.so

在php.ini中

无积极结果.总是说[PDOException]could not find driver.

有人可以解决这个问题吗?

Can someone please help resolving this.

我正在使用的环境:Mac,laravel 4,带有AMP 5.4.4的MAMP PRO

Environment that I am using: Mac, laravel 4, MAMP PRO with php 5.4.4

推荐答案

您可以使用

sudo apt-get install php7-mysql

sudo apt-get install php5-mysql

sudo apt-get install php-mysql

这对我有用.

这篇关于php artisan migration throwing [PDO Exception]找不到驱动程序-使用Laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆