小编典典

Laravel 5 PDOException找不到驱动程序

mysql

我在使用Laravel 5时遇到问题。当我运行“ php aritsan migration”时,出现此错误

**************************************
*     Application In Production!     *
**************************************

Do you really wish to run this command? [y/N] y

[PDOException]
could not find driver

我可以运行该应用程序,但是当需要数据库连接时,出现此错误

PDOException in Connector.php line 55:
could not find driver
in Connector.php line 55
at PDO->__construct('mysql:host=localhost;dbname=mydb', 'root', '', array('0', '2', '0', false, false)) in Connector.php line 55
at Connector->createConnection('mysql:host=localhost;dbname=mydb', array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'mydb', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22

如何解决?


阅读 314

收藏
2020-05-17

共1个答案

小编典典

您应该在服务器上安装PDO。编辑您的php.ini(查看您的phpinfo()“已加载的配置文件”行,以找到php.ini文件路径)。查找并取消注释以下行(删除;字符):

;extension=pdo_mysql.so

然后,重新启动Apache服务器。有关更多信息,请阅读文档

2020-05-17