php artisan migrate 抛出 [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 中
in php.ini
没有阳性结果.它总是说 [PDOException] 找不到驱动程序.
No positive result. It always says [PDOException]could not find driver.
有人可以帮忙解决这个问题.
Can someone please help resolving this.
我使用的环境:Mac、laravel 4、MAMP PRO with php 5.4.4
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
这对我有用.
相关文章