自从我上周五进行了常规的软件包更新后,我的网络服务器出现了一个相当棘手的问题。我在使用mysql_connect()时遇到错误。
Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50532 Library:100005 in /srv/www/***/wp-includes/wp-db.php on line 1142
当我运行php -i时,我得到:
mysqli
MysqlI Support => enabled
Client API library version => 10.0.5-MariaDB
Client API header version => 5.5.32
apt-get install mariadb *
已安装以下软件包的结果:
libmariadbclient18 is already the newest version.
libmariadbclient18 set to manually installed.
mariadb-client is already the newest version.
mariadb-client-10.0 is already the newest version.
mariadb-client-10.0 set to manually installed.
mariadb-client-core-10.0 is already the newest version.
mariadb-client-core-10.0 set to manually installed.
mariadb-common is already the newest version.
mariadb-common set to manually installed.
mariadb-server is already the newest version.
mariadb-server-10.0 is already the newest version.
mariadb-server-10.0 set to manually installed.
mariadb-server-core-10.0 is already the newest version.
mariadb-server-core-10.0 set to manually installed.
我已经在整个网络上查找了这个问题,但是类似的问题似乎都没有带有库版本的-MariaDB标记。
所以我不知道如何解决这个问题。
非常感谢您的帮助!
编辑:
php -i mysql:
MySQL Support => enabled
Client API version => 10.0.5-MariaDB
奇怪的是,没有提到客户端API库版本或 本节中的客户端API标头版本。
答案 0 :(得分:3)
安装PHP的mysqlnd
包,警告应该消失。
对于基于 Debian / Ubuntu 的系统,这将是:
sudo apt install php-mysqlnd
或
sudo apt install php7.0-mysqlnd
安装后重启服务器守护程序(apache,nginx和/或php-fpm)
答案 1 :(得分:2)
启用PHP的 mysqlnd , nd_mysql 和 nd_mysqli 扩展,并在启用时禁用mysql和mysqli(PHP 5.5)。
迟到的回复,但这在搜索结果中很高,这是对我有用的解决方案,作为没有管理员访问服务器的人。