CentOS 7.3 PHP Warning:Headers and client library minor version mismatch. Headers:50564 Library:50645

报错:

/var/log/nginx/error.log
PHP Warning:  mysqli::__construct(): Headers and client library minor version mismatch. Headers:50564 Library:50645

原因:

解析php的服务端版本和实际版本不一致 来验证一下:
# php -i|grep Client

Client API library version => 5.6.45-MariaDB
Client API header version => 5.5.64-MariaDB
Client API version => 5.6.45-MariaDB

解决方法:

卸载低版本php-mysql驱动,安装新版php-mysqlnd驱动

yum remove php-mysql
yum install php-mysqlnd

安装后仍然报错:

Error: php71w-common conflicts with php-common-5.x.xx-xx.el7.x86_64

尝试安装:
# yum install -y php71w-mysqlnd
重启nginx,mariadb和php

systemctl restart nginx
systemctl restart mysqld
systemctl restart php-fpm

再执行:
# php -i|grep Client

Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
Client API version => mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $

版本一致,问题解决。