使用PHP 7.2.4的Ubuntu 16.04缺少PDO驱动程序 [英] PDO drivers missing on Ubuntu 16.04 with PHP 7.2.4

查看:396
本文介绍了使用PHP 7.2.4的Ubuntu 16.04缺少PDO驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Kubuntu 16.04上尝试最新版本的PHP,从那时起,看来我无法在MySQL中使用pdo.

I wanted to try the latest version of PHP on Kubuntu 16.04, since then, it seems I can't use pdo with mysql.

启动php时,出现以下警告:

When I launch php, I have the following warning:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0

我正在跑步

PHP 7.2.4-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Apr  5 2018 08:53:57) ( NTS )

我尝试解决此问题: https://askubuntu.com/a/824505 ,但是我已经同样的问题.

I tried to fix with this solution : https://askubuntu.com/a/824505, but I've the same problem.

但是,在phpinfo中,找到了用于PDO(mysql)的驱动程序. 当我检查php -m时,发现PDO和pdo_mysql.

However, in the phpinfo, there's a driver found for PDO (mysql). When I check a php -m, PDO and pdo_mysql are found.

/usr/lib/php/20170718 /usr/lib/php/20151012 文件夹中,有一个pdo_mysql.so.

In the /usr/lib/php/20170718 and /usr/lib/php/20151012 folder, there is a pdo_mysql.so.

我真的不知道还能尝试什么.预先感谢您的帮助.

I don't really know what else to try. Thanks in advance for your help.

推荐答案

就我而言,我已从Ubuntu 16.04更新到18.04,因此从PHP 7.0更新到7.2.

In my case I had updated from Ubuntu 16.04 to 18.04, thus PHP 7.0 to 7.2.

结果证明,PHP 7.0仍(部分)已安装,并且是Apache的有效PHP-FPM处理程序.

Turns out PHP 7.0 was still (partly) installed, and was the active PHP-FPM handler for Apache.

我以前用来解决此问题的命令:(作为root或通过sudo)

Commands I used to resolve this: (as root or via sudo)

service php7.0-fpm stop
apt-get remove php7.0*
service php7.2-fpm restart
service apache2 restart

请确保将您从/etc/php/7.0进行的所有INI更改复制到/etc/php/7.2.

Be sure to copy any INI changes you made from /etc/php/7.0 to /etc/php/7.2 though.

这篇关于使用PHP 7.2.4的Ubuntu 16.04缺少PDO驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆