Laravel 5:Artisan抛出PDOException找不到驱动程序 [英] Laravel 5: Artisan throw PDOException could not find driver
问题描述
我发现了其他类似问题,但似乎没有一个可以解决我的问题.就我而言,它出现在任何artisan命令上,即使我只是键入"php artisan",其输出也是[PDOException] could not find driver
.
I've found other question like this but none seems to solve my problem. In my case it occurs on any artisan command, even if I just type "php artisan" the output is [PDOException] could not find driver
.
我正在Ubuntu 14.04 LTS上运行Laravel 5,并带有LEMP堆栈(PHP 5.6 fpm,Mysql,Nginx).在config/database.php
中,默认驱动程序设置为mysql.
I'm running Laravel 5 on Ubuntu 14.04 LTS, with a LEMP stack (PHP 5.6 fpm, Mysql, Nginx). In the config/database.php
the default driver is set to mysql.
我已经检查了php --ini
的输出,似乎已加载所有配置文件:
I've checked the output of php --ini
, it seems to load all configuration files:
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: /etc/php5/cli/conf.d/05-opcache.ini,
/etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-gd.ini,
/etc/php5/cli/conf.d/20-json.ini,
/etc/php5/cli/conf.d/20-mcrypt.ini,
/etc/php5/cli/conf.d/20-mysql.ini,
/etc/php5/cli/conf.d/20-mysqli.ini,
/etc/php5/cli/conf.d/20-pdo_mysql.ini,
/etc/php5/cli/conf.d/20-readline.ini
如果我打开/etc/php5/cli/conf.d/20-pdo_mysql.ini
,我会看到:
If i open /etc/php5/cli/conf.d/20-pdo_mysql.ini
i see:
; configuration for php MySQL module
; priority=20
extension=pdo_mysql.so
/etc/php5/cli/conf.d/10-pdo.ini
的内容是:
; configuration for php PDO module
; priority=10
extension=pdo.so
在/etc/php5/cli/conf.d内部,我看到pdo ini文件的符号链接是这样的:
Inside /etc/php5/cli/conf.d i see pdo ini files symlinked like this:
10-pdo.ini -> ../../mods-available/pdo.ini
20-mysql.ini -> ../../mods-available/mysql.ini
20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.ini
符号链接与包含所有ini文件的基本目录/etc/php5/mods-available
相匹配:
The symlink match the base directory /etc/php5/mods-available
that contains all the ini files:
pdo.ini
pdo_mysql.ini
仅此而已.如果有人已经经历过此事,将不胜感激.谢谢!
That's all. If someone already experienced this, some help would be really appreciated. Thanks!
推荐答案
因此,经过多次尝试,我终于找到了解决方法:只需要安装php5-sybase
软件包即可.之后,工匠可以完美工作!
So, after many attempts i finally find out how to fix it: just needed to install php5-sybase
package. After that Artisan works perfectly!
我猜想宅基已经安装好了,很不幸,我需要在VMWare工作站上配置裸机ISO.
I guess on homestead it's already installed, unluckily I needed to configure a bare-bone ISO on a VMWare Workstation.
这篇关于Laravel 5:Artisan抛出PDOException找不到驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!