今天发现 Apache 的日志占用好多的内存,每天都有错误报告生成,经查看发现都是同一个错误,大致如下:
[Sat Apr 23 13:32:15.121449 2016] [:error] [pid 26191] [client 117.27.149.13:56567] PHP Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50547 Library:50629 in /var/www/html/wp/wp-includes/wp-db.php on line 1489
[Sat Apr 23 13:33:45.834286 2016] [:error] [pid 26187] [client 113.70.144.69:50440] PHP Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50547 Library:50629 in /var/www/html/wp/wp-includes/wp-db.php on line 1489, referer: https://www.imweb.xyz/
其实我试过的安装了有两次的版本php遇到这个问题,一个是PHP5.6一个是PHP7.0,解决办法是…直接上命令吧:
PHP5.6:
# yum remove php56w-mysql
# yum install php56w-mysqlnd
# yum install phpmyadmin
PHP7.0:
# yum remove php70w-mysql
# yum install php70w-mysqlnd
# yum install phpmyadmin
当然具体命令要看你安装的 PHP 是什么版本了。
现在再用 php -i | grep Client 命令查看,版本一致了:
# php -i | grep Client
Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: fd3bfdab644600c96b25beaf69d021447b7b4ec5 $
Client API version => mysqlnd 5.0.12-dev - 20150407 - $Id: fd3bfdab644600c96b25beaf69d021447b7b4ec5 $
Soap Client => enabled
By the way,我用的系统是Centos。至于什么是mysqlnd?自个百度吧。
为啥要安装 phpmyadmin? 因为卸载php-mysql的时候,捆绑的 phpmyadmin 也被卸载了哦。安装完记得要重新配置一些 phpmyadmin。