[英]could not find driver (SQL: select user_id
I am getting this error我收到此错误
could not find driver (SQL: select user_id... ]
找不到驱动程序(SQL:选择 user_id... ]
I've looked at other related questions and tried the suggestions but I am still getting the same error.我查看了其他相关问题并尝试了建议,但我仍然遇到相同的错误。
My PHP.ini has extension=php_pdo_mysql.dll我的 PHP.ini 有 extension=php_pdo_mysql.dll
I've added "doctrine/dbal": "^2.5",
我添加了
"doctrine/dbal": "^2.5",
I've also tried clearing cache, config, dump auto load etc.我也试过清除缓存、配置、转储自动加载等。
phpinfo() shows there are no PDO drivers. phpinfo() 显示没有 PDO 驱动程序。
Previously my phpstorm was pointing at a PHP installation that didn't have extension=php_pdo_mysql.dll
enabled but I am still getting the same error even after pointing it to the correct PHP folder.以前,我的 phpstorm 指向没有启用
extension=php_pdo_mysql.dll
的 PHP 安装,但即使将其指向正确的 PHP 文件夹,我仍然遇到相同的错误。
You need to install PDO drivers first and if it did not solve your problem then below is the issue I have faced before maybe that will help.您需要先安装 PDO 驱动程序,如果它没有解决您的问题,那么下面是我之前遇到的问题,也许会有所帮助。
sudo apt-get install php5.6-mysql/php7.2-mysql
You also can search for other database systems.您还可以搜索其他数据库系统。
You also can search for the driver:您也可以搜索驱动程序:
sudo apt-cache search drivername
Then Run the cmd php artisan migrate
然后运行cmd
php artisan migrate
You can also try:你也可以试试:
sudo apt-get install php-sqlite3
also check the path for php-cli
还要检查 php-cli 的路径
If you can, run :如果可以,请运行:
composer update
composer require doctrine/dbal
It looks like you have a missing dependency看起来您缺少依赖项
Edit:编辑:
You might need to comment out the following in your php.ini file.您可能需要在 php.ini 文件中注释掉以下内容。
;extension=pdo_mysql.so
Taken from this post: Laravel 5 PDOException Could Not Find Driver .摘自这篇文章:Laravel 5 PDOException 无法找到驱动程序。 I think I had to do something exactly like this when setting up laravel on digital ocean.
我想在数字海洋上设置 Laravel 时,我必须做类似的事情。
There must be Query like this one in the code implode inside SQL code. SQL代码内部的代码内爆一定有这样的Query。 check the variable $mistakeIdArr should not be empty.
检查变量 $mistakeIdArr 不应为空。
$sql = "Select * from `mistake` where `id` in (".implode(',',$mistakeIdArr).")";
I have also checked in my code the PDO is enabled or not我还检查了我的代码是否启用了 PDO
if (extension_loaded('pdo')) { echo "pdo enable";die; }else{ echo "not enable";die;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.