我尝试php-mysql
在我的 cent-os 服务器上安装并收到此错误:
[root@Cloud-POC ~]# yum install mysql-libs-5.1
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* epel: kartolo.sby.datautama.net.id
* extras: centos.excellmedia.net
* ius: mirrors.ircam.fr
* remi: fr2.rpmfind.net
* remi-safe: fr2.rpmfind.net
* updates: centos.excellmedia.net
* webtatic: uk.repo.webtatic.com
No package mysql-libs-5.1 available.
Error: Nothing to do
[root@Cloud-POC ~]#
[root@Cloud-POC ~]# yum install php-mysql
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* epel: kartolo.sby.datautama.net.id
* extras: centos.excellmedia.net
* ius: mirrors.ircam.fr
* remi: fr2.rpmfind.net
* remi-safe: fr2.rpmfind.net
* updates: centos.excellmedia.net
* webtatic: uk.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.x86_64 0:5.4.45-12.el6.remi will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.45-12.el6.remi for package: php-mysql-5.4.45-12.el6.remi.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: php-mysql-5.4.45-12.el6.remi.x86_64
Package mysql-libs-5.5.53-1.el6.remi.x86_64 is obsoleted by mysql-community-libs-compat-5.6.34-2.el6.x86_64 which is already installed
--> Running transaction check
---> Package php-mysql.x86_64 0:5.4.45-12.el6.remi will be installed
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: php-mysql-5.4.45-12.el6.remi.x86_64
Package mysql-libs-5.5.53-1.el6.remi.x86_64 is obsoleted by mysql-community-libs-compat-5.6.34-2.el6.x86_64 which is already installed
---> Package php-pdo.x86_64 0:5.4.45-12.el6.remi will be installed
--> Finished Dependency Resolution
Error: Package: php-mysql-5.4.45-12.el6.remi.x86_64 (remi)
Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql-libs-5.5.52-1.el6.remi.x86_64 (remi)
libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql-libs-5.5.53-1.el6.remi.x86_64 (remi)
libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql55-libs-5.5.52-1.ius.centos6.x86_64 (ius)
libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql55w-libs-5.5.50-1.w6.x86_64 (webtatic)
libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql55w-libs-5.5.52-1.w6.x86_64 (webtatic)
libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql55w-libs-5.5.53-1.w6.x86_64 (webtatic)
libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql56u-libs-5.6.33-1.ius.centos6.x86_64 (ius)
libmysqlclient.so.18(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.73-7.el6.i686 (base)
Not found
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
答案1
更好的解决方案是安装 php-mysqlnd,它使用本机驱动程序提供相同的 3 个扩展(mysql、mysqli 和 pdo_mysql),并且不依赖 libmysqlclient
请记住,PHP 5.4 已停止使用并且 PHP 项目不再维护。