Centos

無法在 Centos7 上安裝 php-mssql 或 freetds

  • April 25, 2017

我的目標是使用 PHP 連接到 MS SQL Server 2005。我已經安裝了 PHP 和 ODBC。我正在執行 CentOS7。

PHP Version => 5.4.16

….(來自 php -i)….

odbc

ODBC Support => enabled

我在嘗試安裝 freetds 和 php-mssql 擴展時遇到了 2 個依賴問題。(見下文)

[root@localhost freetds-dev.0.92.377]# yum install php-mssql freetds
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.supremebytes.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.cat.pdx.edu
* rpmforge: mirror.hmc.edu
* updates: ftp.osuosl.org
Resolving Dependencies
--> Running transaction check
---> Package freetds.x86_64 0:0.91-2.el6 will be installed
--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4)(64bit) for package: freetds-0.91-2.el6.x86_64
--> Processing Dependency: libgnutls.so.26()(64bit) for package: freetds-0.91-2.el6.x86_64
---> Package php-mssql.x86_64 0:5.3.3-3.el6 will be installed
--> Processing Dependency: php(zend-abi) = 20090626 for package: php-mssql-5.3.3-3.el6.x86_64
--> Processing Dependency: php(api) = 20090626 for package: php-mssql-5.3.3-3.el6.x86_64
--> Finished Dependency Resolution
Error: Package: freetds-0.91-2.el6.x86_64 (epel)
          Requires: libgnutls.so.26()(64bit)
Error: Package: php-mssql-5.3.3-3.el6.x86_64 (epel)
          Requires: php(api) = 20090626
          Installed: php-common-5.4.16-23.el7_0.3.x86_64 (@updates)
              php(api) = 20100412-64
          Available: php-common-5.4.16-21.el7.x86_64 (base)
              php(api) = 20100412-64
          Available: php-common-5.4.16-23.el7_0.x86_64 (updates)
              php(api) = 20100412-64
          Available: php-common-5.4.16-23.el7_0.1.x86_64 (updates)
              php(api) = 20100412-64
Error: Package: freetds-0.91-2.el6.x86_64 (epel)
          Requires: libgnutls.so.26(GNUTLS_1_4)(64bit)
Error: Package: php-mssql-5.3.3-3.el6.x86_64 (epel)
          Requires: php(zend-abi) = 20090626
          Installed: php-common-5.4.16-23.el7_0.3.x86_64 (@updates)
              php(zend-abi) = 20100525-64
          Available: php-common-5.4.16-21.el7.x86_64 (base)
              php(zend-abi) = 20100525-64
          Available: php-common-5.4.16-23.el7_0.x86_64 (updates)
              php(zend-abi) = 20100525-64
          Available: php-common-5.4.16-23.el7_0.1.x86_64 (updates)
              php(zend-abi) = 20100525-64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

我有 libgnutls.so 版本 28

/usr/lib64/libgnutls.so.28
/usr/lib64/libgnutls.so.28.20.4

您嘗試安裝的軟體包el6在版本中,表明它適用於 CentOS 6,而不是 7。您似乎為錯誤版本的 CentOS 添加了 EPEL 儲存庫。您應該刪除yumEPEL6 的配置並添加 7 的配置。您可以使用以下內容添加 7 的配置:

rpm -Uvh http://mirror.oss.ou.edu/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

我在同樣的問題上苦苦掙扎,我知道我在 OS 7 上。

我應該嘗試單獨安裝 freetds 嗎?

Red Hat Enterprise Linux Server release 7.3 (Maipo)

Installed:
 epel-release.noarch 0:7-9

Error: Package: freetds-0.91-2.el6.x86_64 (epel)
          Requires: libgnutls.so.26(GNUTLS_1_4)(64bit)

/usr/lib64/.libgnutls.so.28.41.16.hmac
/usr/lib64/.libgnutls.so.28.hmac
/usr/lib64/libgnutls.so.28
/usr/lib64/libgnutls.so.28.41.16

引用自:https://unix.stackexchange.com/questions/181478