Php
嘗試安裝已安裝 MariaDB 的 PHP MySQL 驅動程序
我有一個來自名為CentOS 6.4 x64,Nginx,php-fpm,MariaDB的圖像的 VPS 。PHP 和 MariaDB 都安裝了,但是 PHP 好像沒有安裝 MySQL 驅動。我首先嘗試添加
extension=mysql.so
對我
php.ini
來說,但這給了我以下錯誤:Starting php-fpm: [12-Dec-2013 17:23:27] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - /usr/lib64/php/modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
然後我嘗試
yum install php-mysql
但得到以下結果:Resolving Dependencies --> Running transaction check ---> Package php-mysql.x86_64 0:5.4.23-1.el6.remi will be installed --> Processing Dependency: php-pdo(x86-64) = 5.4.23-1.el6.remi for package: php-mysql-5.4.23-1.el6.remi.x86_64 --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: php-mysql-5.4.23-1.el6.remi.x86_64 Package mysql-libs-5.5.35-1.el6.remi.x86_64 is obsoleted by MariaDB-shared-5.5.32-1.i386 which is already installed --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: php-mysql-5.4.23-1.el6.remi.x86_64 Package mysql-libs-5.5.35-1.el6.remi.x86_64 is obsoleted by MariaDB-shared-5.5.32-1.i386 which is already installed --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: php-mysql-5.4.23-1.el6.remi.x86_64 Package mysql-libs-5.5.35-1.el6.remi.x86_64 is obsoleted by MariaDB-shared-5.5.32-1.i386 which is already installed --> Finished Dependency Resolution Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi) Requires: libmysqlclient.so.18()(64bit) Available: compat-mysql55-5.5.11-1.el6.remi.x86_64 (remi-test) libmysqlclient.so.18()(64bit) Available: compat-mysql55-5.5.34-1.el6.remi.x86_64 (remi-test) libmysqlclient.so.18()(64bit) Available: mysql-libs-5.5.34-1.el6.remi.x86_64 (remi) libmysqlclient.so.18()(64bit) Available: mysql-libs-5.5.35-1.el6.remi.x86_64 (remi) libmysqlclient.so.18()(64bit) Available: mysql-libs-5.1.71-1.el6.i686 (base) Not found Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi) Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit) Available: compat-mysql55-5.5.11-1.el6.remi.x86_64 (remi-test) libmysqlclient.so.18(libmysqlclient_16)(64bit) Available: compat-mysql55-5.5.34-1.el6.remi.x86_64 (remi-test) libmysqlclient.so.18(libmysqlclient_16)(64bit) Available: mysql-libs-5.5.34-1.el6.remi.x86_64 (remi) libmysqlclient.so.18(libmysqlclient_16)(64bit) Available: mysql-libs-5.5.35-1.el6.remi.x86_64 (remi) libmysqlclient.so.18(libmysqlclient_16)(64bit) Available: mysql-libs-5.1.71-1.el6.i686 (base) Not found Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi) Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit) Available: compat-mysql55-5.5.11-1.el6.remi.x86_64 (remi-test) libmysqlclient.so.18(libmysqlclient_18)(64bit) Available: compat-mysql55-5.5.34-1.el6.remi.x86_64 (remi-test) libmysqlclient.so.18(libmysqlclient_18)(64bit) Available: mysql-libs-5.5.34-1.el6.remi.x86_64 (remi) libmysqlclient.so.18(libmysqlclient_18)(64bit) Available: mysql-libs-5.5.35-1.el6.remi.x86_64 (remi) libmysqlclient.so.18(libmysqlclient_18)(64bit) Available: mysql-libs-5.1.71-1.el6.i686 (base) Not found Error: Package: php-mysql-5.4.23-1.el6.remi.x86_64 (remi) Requires: php-pdo(x86-64) = 5.4.23-1.el6.remi Installed: php-pdo-5.5.0-1.el6.remi.x86_64 (@remi-test) php-pdo(x86-64) = 5.5.0-1.el6.remi Available: php-pdo-5.3.3-26.el6.x86_64 (base) php-pdo(x86-64) = 5.3.3-26.el6 Available: php-pdo-5.3.3-27.el6_5.x86_64 (updates) php-pdo(x86-64) = 5.3.3-27.el6_5 Available: php-pdo-5.4.22-1.el6.remi.x86_64 (remi) php-pdo(x86-64) = 5.4.22-1.el6.remi Available: php-pdo-5.4.23-1.el6.remi.x86_64 (remi) php-pdo(x86-64) = 5.4.23-1.el6.remi You could try using --skip-broken to work around the problem ** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows: 2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()(64bit) 2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit) 2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs
我該怎麼辦?當然我不想安裝 MySQL 本身,只安裝 PHP 驅動程序。
注意:這是來自https://stackoverflow.com/questions/20561527/install-php-mysql-to-use-mariadb的交叉文章,但也許它實際上比 StackOverflow 更適合這裡
更新 1
在約翰的建議下,我嘗試了
yum install php-mysql --disablerepo=remi
. 然而,這仍然給了我更多的問題:Error: Package: php-mysql-5.3.3-27.el6_5.x86_64 (updates) Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit) Available: mysql-libs-5.1.71-1.el6.x86_64 (base) libmysqlclient.so.16(libmysqlclient_16)(64bit) Error: Package: php-mysql-5.3.3-27.el6_5.x86_64 (updates) Requires: libmysqlclient.so.16()(64bit) Available: mysql-libs-5.1.71-1.el6.x86_64 (base) libmysqlclient.so.16()(64bit) Error: Package: php-mysql-5.3.3-27.el6_5.x86_64 (updates) Requires: php-common(x86-64) = 5.3.3-27.el6_5 Installed: php-common-5.5.0-1.el6.remi.x86_64 (@remi-test) php-common(x86-64) = 5.5.0-1.el6.remi Available: php-common-5.3.3-26.el6.x86_64 (base) php-common(x86-64) = 5.3.3-26.el6 Available: php-common-5.3.3-27.el6_5.x86_64 (updates) php-common(x86-64) = 5.3.3-27.el6_5
更新 2
如果我嘗試
yum install php-mysqlnd
,那麼依賴錯誤就會減少:Error: Package: php-mysqlnd-5.4.23-1.el6.remi.x86_64 (remi) Requires: php-pdo(x86-64) = 5.4.23-1.el6.remi Installed: php-pdo-5.5.0-1.el6.remi.x86_64 (@remi-test) php-pdo(x86-64) = 5.5.0-1.el6.remi Available: php-pdo-5.3.3-26.el6.x86_64 (base) php-pdo(x86-64) = 5.3.3-26.el6 Available: php-pdo-5.3.3-27.el6_5.x86_64 (updates) php-pdo(x86-64) = 5.3.3-27.el6_5 Available: php-pdo-5.4.22-1.el6.remi.x86_64 (remi) php-pdo(x86-64) = 5.4.22-1.el6.remi Available: php-pdo-5.4.23-1.el6.remi.x86_64 (remi) php-pdo(x86-64) = 5.4.23-1.el6.remi
所以我只需要找到一些 php-mysqlnd 5.5 的原始碼,這顯然在
remi-test
. 我可以在哪裡找到這個的任何想法?我只想要這個特定的包,所以也許我應該下載它並從原始碼建構?
好吧,我終於設法通過添加
remi-php55
儲存庫來解決這個問題。簡而言之,我將以下內容添加到/etc/yum.repos.d/remi.repo
:[remi-php55] name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 6 - $basearch #baseurl=http://rpms.famillecollet.com/enterprise/6/php55/$basearch/ mirrorlist=http://rpms.famillecollet.com/enterprise/6/php55/mirror # WARNING: If you enable this repository, you must also enable "remi" enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi [remi-php55-debuginfo] name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 6 - $basearch - debuginfo baseurl=http://rpms.famillecollet.com/enterprise/6/debug-php55/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
然後繼續使用命令安裝:
yum install --enablerepo=remi-php55 php-mysqlnd