[英]PDOException in my Laravel application, despite having pdo_mysql installed
I am trying to run a new Laravel app on my sever but I am getting the following error: 我正在尝试在服务器上运行新的Laravel应用程序,但出现以下错误:
QueryException (SQL) could not find driver (SQL: select * from
settings
limit 1)QueryException(SQL)找不到驱动程序(SQL:从
settings
限制1中选择*)
Using the debugbar I can see the error is for PDO: LOG.error: 使用调试栏,我可以看到错误是针对PDO的:LOG.error:
PDOException: could not find driver in /home/mysite.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:
PDOException:在/home/mysite.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php中找不到驱动程序:
What doesn't make sense is that I actually already have PDO installed, I know this because I ran the first php artisan migrate
and it created all the tables in my MYSQL DB fine. 没有任何意义的是,我实际上已经安装了PDO,我知道这是因为我运行了第一个
php artisan migrate
并在MYSQL DB中很好地创建了所有表。
I have ran php -m | grep mysql
我已经运行了
php -m | grep mysql
php -m | grep mysql
to verify what mysql related PHP extensions I have: php -m | grep mysql
验证我拥有哪些与mysql相关的PHP扩展:
$ php -m | grep mysql
mysqli
mysqlnd
pdo_mysql
I should note that PHP can use MySQL as I have a Wordpress blog running on the same server fine. 我应该注意,PHP 可以使用MySQL,因为我的Wordpress博客可以在同一台服务器上运行。
I have already tried clearing the cache and updating composer packages, I have also completely removed doctrine/dbal
and reinstalled. 我已经尝试清除缓存并更新composer程序包,也完全删除了
doctrine/dbal
并重新安装。
Update: If I remove the package doctrine/dbal
and clear the caches, I still receive an error about PDOExceptions: 更新:如果我删除了软件包
doctrine/dbal
并清除了缓存,我仍然会收到有关PDOExceptions的错误:
Illuminate\\Database\\QueryException could not find driver /home/mysite.com/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php#68
Illuminate \\ Database \\ QueryException找不到驱动程序/home/mysite.com/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php#68
Try this: 尝试这个:
composer update
composer require doctrine/dbal
It looks like you have a missing dependency 看起来您缺少依赖项
Notice: 注意:
You might need to comment out the following in your php.ini file. 您可能需要在php.ini文件中注释掉以下内容。
;extension=pdo_mysql.so
stackoverflow.com/a/42561002/2109233 source stackoverflow.com/a/42561002/2109233源
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.