Php

找不到 php-fpm to for PHP 7.2 to install on Centos 7.5

  • November 13, 2018

已經為一個項目創建了一個新的 VM 伺服器,它執行的是 Centos 7.5。在網上閱讀了大量不同的文章以嘗試在這個盒子上執行 nginx 和 PHP 7.2 之後,我無法獲得正確版本的 PHP 或 PHP-FPM 模組來安裝。

我執行了以下命令:

yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql php-fpm

結果如下

Dependencies Resolved

Package                Arch     Version                 Repository        Size

Installing:
 php                    x86_64   5.4.16-45.el7           centos           1.4 M
 php-cli                x86_64   5.4.16-45.el7           centos           2.7 M
 php-common             x86_64   5.4.16-45.el7           centos           565 k
 php-fpm                x86_64   5.4.16-45.el7           centos           1.4 M
 php-gd                 x86_64   5.4.16-45.el7           centos           128 k
 php-mcrypt             x86_64   5.4.16-7.el7            epel_mirror       20 k
 php-mysql              x86_64   5.4.16-45.el7           centos           101 k
 php-pecl-zendopcache   x86_64   7.0.5-2.el7             epel_mirror       74 k
Installing for dependencies:
 httpd                  x86_64   2.4.6-80.el7.centos.1   centos-updates   2.7 M
 httpd-tools            x86_64   2.4.6-80.el7.centos.1   centos-updates    90 k
 libmcrypt              x86_64   2.5.8-13.el7            epel_mirror       99 k
 libzip                 x86_64   0.10.1-8.el7            centos            48 k
 php-pdo                x86_64   5.4.16-45.el7           centos            99 k
 php-pear               noarch   1:1.9.4-21.el7          centos           357 k
 php-process            x86_64   5.4.16-45.el7           centos            56 k
 php-xml                x86_64   5.4.16-45.el7           centos           126 k
 t1lib                  x86_64   5.1.2-14.el7            centos           166 k

我真的很難弄清楚為什麼這不起作用 - 任何和所有的幫助都表示讚賞。

如果需要更多資訊,請詢問:) t2t

更新

我嘗試關注的最新文章是:https ://www.if-not-true-then-false.com/2011/install-nginx-php-fpm-on-fedora-centos-red-hat-rhel/

在那裡執行安裝命令:

yum --enablerepo=remi,remi-php72 install nginx php-fpm php-common

結果(截斷以顯示 PHP 版本):

php-common     x86_64        5.4.16-45.el7       centos                               565 k
php-fpm        x86_64        5.4.16-45.el7       centos                               1.4 M

完整資訊

根據以下評論中的要求…

$ sudo -i
[sudo] password for youngm: 
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-rele ase-latest-7.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Preparing... 
   package epel-release-7-11.noarch is already installed
# 
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Retrieving http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Preparing... 
   package remi-release-7.5-2.el7.remi.noarch is already installed
# yum --enablerepo=remi,remi-php72 install nginx php-fpm php-common
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile

centos                                                                                                                                                                                                                | 2.1 kB  00:00:00     

epel_mirror                                                                                                                                                                                                           | 2.1 kB  00:00:00     
639 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-filesystem = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-all-modules = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.12.2-2.el7.x86_64
---> Package php-common.x86_64 0:5.4.16-45.el7 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-45.el7.x86_64
---> Package php-fpm.x86_64 0:5.4.16-45.el7 will be installed
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package nginx-all-modules.noarch 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-mod-stream = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-mail = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-xslt-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-perl = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-image-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-geoip = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
---> Package nginx-filesystem.noarch 1:1.12.2-2.el7 will be installed
--> Running transaction check
---> Package nginx-mod-http-geoip.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-image-filter.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-perl.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-xslt-filter.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-mail.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-stream.x86_64 1:1.12.2-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
Package                                                               Arch                                             Version                                                  Repository                                             Size
=============================================================================================================================================================================================================================================
Installing:
nginx                                                                 x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                           530 k
php-common                                                            x86_64                                           5.4.16-45.el7                                            centos                                                565 k
php-fpm                                                               x86_64                                           5.4.16-45.el7                                            centos                                                1.4 M
Installing for dependencies:
libzip                                                                x86_64                                           0.10.1-8.el7                                             centos                                                 48 k
nginx-all-modules                                                     noarch                                           1:1.12.2-2.el7                                           epel_mirror                                            16 k
nginx-filesystem                                                      noarch                                           1:1.12.2-2.el7                                           epel_mirror                                            17 k
nginx-mod-http-geoip                                                  x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            23 k
nginx-mod-http-image-filter                                           x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            26 k
nginx-mod-http-perl                                                   x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            36 k
nginx-mod-http-xslt-filter                                            x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            26 k
nginx-mod-mail                                                        x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            54 k
nginx-mod-stream                                                      x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            76 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  3 Packages (+9 Dependent packages)

Total download size: 2.8 M
Installed size: 10 M
Is this ok [y/d/N]: n
Exiting on user command
Your transaction was saved, rerun it with:
yum load-transaction /tmp/yum_save_tx.2018-11-13.14-37.LmQUgX.yumtx
# 

這是你的問題:

639 packages excluded due to repository priority protections

/etc/yum.conf您或其他人通過在目錄中的各個 repo 文件中設置優先級,明確排除了軟體包安裝在您的系統上/etc/yum.repos.d

檢查所有這些文件中讀取priority=###where ###is a number 的行,並刪除您找到的任何內容。然後再次嘗試安裝軟體包。

為確保不再發生這種情況,您還應該使用類似yum remove yum-plugin-priorities.

引用自:https://serverfault.com/questions/939816