在PHP中,每当尝试连接到数据库时,都会收到以下警告(通过mysql_connect)
mysql_connect
警告:mysql_connect():标头和客户端库次要版本不匹配。标头:50162图书馆:50524
在我的php -i输出中,我在mysqli下列出了以下值
php -i
客户端API库版本=> 5.5.24 客户端API标头版本=> 5.1.62
客户端API库版本=> 5.5.24
客户端API标头版本=> 5.1.62
我已经尝试更新php5-mysql 和 php,但是我已经拥有了两者的最新版本。我该如何更新标头版本,以便不再看到此警告?
编辑
我的MySQL文件都应更新为最新版本:
$ apt-get install mysql.*5.5 . . . mysql-client-5.5 is already the newest version. mysql-server-core-5.5 is already the newest version. mysql-server-5.5 is already the newest version. mysql-testsuite-5.5 is already the newest version. mysql-source-5.5 is already the newest version.
删除旧版本
$ apt-get remove mysql.*5.1 . . . Package handlersocket-mysql-5.1 is not installed, so not removed Package mysql-cluster-client-5.1 is not installed, so not removed Package mysql-cluster-server-5.1 is not installed, so not removed Package mysql-client-5.1 is not installed, so not removed Package mysql-client-core-5.1 is not installed, so not removed Package mysql-server-5.1 is not installed, so not removed Package mysql-server-core-5.1 is not installed, so not removed Package mysql-source-5.1 is not installed, so not removed
您的PHP是使用MySQL 5.1编译的,但是现在它链接了5.5.X系列的MySQL库。您必须将PHP升级到使用MySQL 5.5编译的版本,或者将mysql客户端库还原为5.1.x。