異なるバージョンのPHPをインストールするには、centos 7で以下の手順に従ってください。

異なるバージョンのPHPをインストールするには、centos 7で以下の手順に従ってください。

次のコマンドを実行しました。

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php70

この段階ではエラーはありません。

私が実行したとき:

yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

私は持っています:

Loaded plugins: fastestmirror, universal-hooks
remi-php70                                                                                                                                                                                  | 2.9 kB  00:00:00     
remi-php70/primary_db                                                                                                                                                                       | 208 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * EA4: 85.13.201.2
 * cpanel-addons-production-feed: 85.13.201.2
 * base: centos.mirrors.ovh.net
 * epel: mirror.nl.leaseweb.net
 * extras: centos.mirrors.ovh.net
 * remi-php70: remi.mirror.wearetriple.com
 * remi-safe: remi.mirror.wearetriple.com
 * updates: centos.mirrors.ovh.net
No package php available.
No package php-mcrypt available.
No package php-cli available.
No package php-gd available.
No package php-curl available.
No package php-mysql available.
No package php-ldap available.
No package php-zip available.
No package php-fileinfo available.
Error: Nothing to do

実行しました。yum clean allその後、前のコマンドを再実行しましたが、何も変更されませんでした。

検索してみると、yum search php7たくさんのパッケージを見ましたが、決定を下すのに十分な知識がありませんでした。

提案を歓迎します!

編集1

これは次のコマンドを実行した結果ですyum search php7

Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 85.13.201.2
 * cpanel-addons-production-feed: 85.13.201.2
 * base: centos.mirrors.ovh.net
 * epel: mirror.nl.leaseweb.net
 * extras: centos.mirrors.ovh.net
 * remi-php70: remi.mirror.wearetriple.com
 * remi-safe: remi.mirror.wearetriple.com
 * updates: centos.mirrors.ovh.net
================================================================================================ N/S matched: php7 ================================================================================================
ea-php70-libc-client-debuginfo.x86_64 : Debug information for package ea-php70-libc-client
ea-php70-php-debuginfo.x86_64 : Debug information for package ea-php70-php
ea-php70-php-ioncube6-debuginfo.x86_64 : Debug information for package ea-php70-php-ioncube6
ea-php70-runtime.x86_64 : Package that handles ea-php70 Software Collection.
ea-php70-scldevel.x86_64 : Package shipping development files for ea-php70
ea-php71-libc-client-debuginfo.x86_64 : Debug information for package ea-php71-libc-client
ea-php71-php-debuginfo.x86_64 : Debug information for package ea-php71-php
ea-php71-runtime.x86_64 : Package that handles ea-php71 Software Collection.
ea-php71-scldevel.x86_64 : Package shipping development files for ea-php71
ea-php72-libc-client-debuginfo.x86_64 : Debug information for package ea-php72-libc-client
ea-php72-php-debuginfo.x86_64 : Debug information for package ea-php72-php
ea-php72-runtime.x86_64 : Package that handles ea-php72 Software Collection.
ea-php72-scldevel.x86_64 : Package shipping development files for ea-php72
ea-php70.x86_64 : Package that installs PHP 7.0
ea-php70-build.x86_64 : Package shipping basic build configuration
ea-php70-libc-client.x86_64 : UW C-client mail library
ea-php70-libc-client-devel.x86_64 : Development tools for programs which will use the UW IMAP library
ea-php70-libc-client-static.x86_64 : UW IMAP static library
ea-php70-pear.noarch : PHP Extension and Application Repository framework
ea-php70-php.x86_64 : PHP DSO
ea-php70-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php70-php-bz2.x86_64 : A module for PHP applications that interface with .bz2 files
ea-php70-php-calendar.x86_64 : A module for PHP applications that need date/time calculations
ea-php70-php-cli.x86_64 : Command-line interface for PHP
ea-php70-php-common.x86_64 : Common files for PHP
ea-php70-php-curl.x86_64 : A module for PHP applications that need to interface with curl
ea-php70-php-dba.x86_64 : A database abstraction layer module for PHP applications
ea-php70-php-dbg.x86_64 : The interactive PHP debugger
ea-php70-php-devel.x86_64 : Files needed for building PHP extensions
ea-php70-php-enchant.x86_64 : Enchant spelling extension for PHP applications
ea-php70-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php70-php-fileinfo.x86_64 : A module for PHP applications that need to detect file types
ea-php70-php-fpm.x86_64 : PHP FastCGI Process Manager
ea-php70-php-ftp.x86_64 : A module for PHP applications that need full FTP protocol support
ea-php70-php-gd.x86_64 : A module for PHP applications for using the gd graphics library
ea-php70-php-gettext.x86_64 : A module for PHP applications that need native language support
ea-php70-php-gmp.x86_64 : A module for PHP applications for using the GNU MP library
ea-php70-php-iconv.x86_64 : A module for PHP applications that need to convert character sets
ea-php70-php-imap.x86_64 : A module for PHP applications that use IMAP
ea-php70-php-intl.x86_64 : Internationalization extension for PHP applications
ea-php70-php-ioncube10.x86_64 : Experimental v10 Loader for ionCube-encoded PHP files
ea-php70-php-ioncube6.x86_64 : Experimental v6 Loader for ionCube-encoded PHP files
ea-php70-php-ldap.x86_64 : A module for PHP applications that use LDAP
ea-php70-php-litespeed.x86_64 : LiteSpeed Web Server PHP support
ea-php70-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php70-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
ea-php70-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
ea-php70-php-odbc.x86_64 : A module for PHP applications that use ODBC databases
ea-php70-php-opcache.x86_64 : The Zend OPcache
ea-php70-php-pdo.x86_64 : A database access abstraction module for PHP applications
ea-php70-php-pgsql.x86_64 : A PostgreSQL database module for PHP
ea-php70-php-phalcon.x86_64 : A full-stack PHP framework delivered as a C-extension
ea-php70-php-posix.x86_64 : Modules for PHP scripts that need access to POSIX functions
ea-php70-php-process.x86_64 : Modules for PHP script using system process interfaces
ea-php70-php-pspell.x86_64 : A module for PHP applications for using pspell interfaces
ea-php70-php-recode.x86_64 : A module for PHP applications for using the recode library
ea-php70-php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
ea-php70-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
ea-php70-php-sockets.x86_64 : A module for PHP applications that need low-level access to sockets
ea-php70-php-sourceguardian.x86_64 : Loader for SourceGuardian-encoded PHP files
ea-php70-php-tidy.x86_64 : Standard PHP module provides tidy library support
ea-php70-php-xml.x86_64 : A module for PHP applications which use XML
ea-php70-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
ea-php70-php-zip.x86_64 : A module for PHP applications that need to handle .zip files
ea-php71.x86_64 : Package that installs PHP 7.1
ea-php71-build.x86_64 : Package shipping basic build configuration
ea-php71-libc-client.x86_64 : UW C-client mail library
ea-php71-libc-client-devel.x86_64 : Development tools for programs which will use the UW IMAP library
ea-php71-libc-client-static.x86_64 : UW IMAP static library
ea-php71-pear.noarch : PHP Extension and Application Repository framework
ea-php71-php.x86_64 : PHP DSO
ea-php71-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php71-php-bz2.x86_64 : A module for PHP applications that interface with .bz2 files
ea-php71-php-calendar.x86_64 : A module for PHP applications that need date/time calculations
ea-php71-php-cli.x86_64 : Command-line interface for PHP
ea-php71-php-common.x86_64 : Common files for PHP
ea-php71-php-curl.x86_64 : A module for PHP applications that need to interface with curl
ea-php71-php-dba.x86_64 : A database abstraction layer module for PHP applications
ea-php71-php-dbg.x86_64 : The interactive PHP debugger
ea-php71-php-devel.x86_64 : Files needed for building PHP extensions
ea-php71-php-enchant.x86_64 : Enchant spelling extension for PHP applications
ea-php71-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php71-php-fileinfo.x86_64 : A module for PHP applications that need to detect file types
ea-php71-php-fpm.x86_64 : PHP FastCGI Process Manager
ea-php71-php-ftp.x86_64 : A module for PHP applications that need full FTP protocol support
ea-php71-php-gd.x86_64 : A module for PHP applications for using the gd graphics library
ea-php71-php-gettext.x86_64 : A module for PHP applications that need native language support
ea-php71-php-gmp.x86_64 : A module for PHP applications for using the GNU MP library
ea-php71-php-iconv.x86_64 : A module for PHP applications that need to convert character sets
ea-php71-php-imap.x86_64 : A module for PHP applications that use IMAP
ea-php71-php-intl.x86_64 : Internationalization extension for PHP applications
ea-php71-php-ioncube10.x86_64 : Experimental v10 Loader for ionCube-encoded PHP files
ea-php71-php-ldap.x86_64 : A module for PHP applications that use LDAP
ea-php71-php-litespeed.x86_64 : LiteSpeed Web Server PHP support
ea-php71-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php71-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
ea-php71-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
ea-php71-php-odbc.x86_64 : A module for PHP applications that use ODBC databases
ea-php71-php-opcache.x86_64 : The Zend OPcache
ea-php71-php-pdo.x86_64 : A database access abstraction module for PHP applications
ea-php71-php-pgsql.x86_64 : A PostgreSQL database module for PHP
ea-php71-php-phalcon.x86_64 : A full-stack PHP framework delivered as a C-extension
ea-php71-php-posix.x86_64 : Modules for PHP scripts that need access to POSIX functions
ea-php71-php-process.x86_64 : Modules for PHP script using system process interfaces
ea-php71-php-pspell.x86_64 : A module for PHP applications for using pspell interfaces
ea-php71-php-recode.x86_64 : A module for PHP applications for using the recode library
ea-php71-php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
ea-php71-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
ea-php71-php-sockets.x86_64 : A module for PHP applications that need low-level access to sockets
ea-php71-php-tidy.x86_64 : Standard PHP module provides tidy library support
ea-php71-php-xml.x86_64 : A module for PHP applications which use XML
ea-php71-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
ea-php71-php-zip.x86_64 : A module for PHP applications that need to handle .zip files
ea-php72.x86_64 : Package that installs PHP 7.2
ea-php72-build.x86_64 : Package shipping basic build configuration
ea-php72-libc-client.x86_64 : UW C-client mail library
ea-php72-libc-client-devel.x86_64 : Development tools for programs which will use the UW IMAP library
ea-php72-libc-client-static.x86_64 : UW IMAP static library
ea-php72-pear.noarch : PHP Extension and Application Repository framework
ea-php72-php.x86_64 : PHP DSO
ea-php72-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php72-php-bz2.x86_64 : A module for PHP applications that interface with .bz2 files
ea-php72-php-calendar.x86_64 : A module for PHP applications that need date/time calculations
ea-php72-php-cli.x86_64 : Command-line interface for PHP
ea-php72-php-common.x86_64 : Common files for PHP
ea-php72-php-curl.x86_64 : A module for PHP applications that need to interface with curl
ea-php72-php-dba.x86_64 : A database abstraction layer module for PHP applications
ea-php72-php-dbg.x86_64 : The interactive PHP debugger
ea-php72-php-devel.x86_64 : Files needed for building PHP extensions
ea-php72-php-enchant.x86_64 : Enchant spelling extension for PHP applications
ea-php72-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php72-php-fileinfo.x86_64 : A module for PHP applications that need to detect file types
ea-php72-php-fpm.x86_64 : PHP FastCGI Process Manager
ea-php72-php-ftp.x86_64 : A module for PHP applications that need full FTP protocol support
ea-php72-php-gd.x86_64 : A module for PHP applications for using the gd graphics library
ea-php72-php-gettext.x86_64 : A module for PHP applications that need native language support
ea-php72-php-gmp.x86_64 : A module for PHP applications for using the GNU MP library
ea-php72-php-iconv.x86_64 : A module for PHP applications that need to convert character sets
ea-php72-php-imap.x86_64 : A module for PHP applications that use IMAP
ea-php72-php-intl.x86_64 : Internationalization extension for PHP applications
ea-php72-php-ioncube10.x86_64 : Experimental v10 Loader for ionCube-encoded PHP files
ea-php72-php-ldap.x86_64 : A module for PHP applications that use LDAP
ea-php72-php-litespeed.x86_64 : LiteSpeed Web Server PHP support
ea-php72-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php72-php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
ea-php72-php-odbc.x86_64 : A module for PHP applications that use ODBC databases
ea-php72-php-opcache.x86_64 : The Zend OPcache
ea-php72-php-pdo.x86_64 : A database access abstraction module for PHP applications
ea-php72-php-pgsql.x86_64 : A PostgreSQL database module for PHP
ea-php72-php-posix.x86_64 : Modules for PHP scripts that need access to POSIX functions
ea-php72-php-process.x86_64 : Modules for PHP script using system process interfaces
ea-php72-php-pspell.x86_64 : A module for PHP applications for using pspell interfaces
ea-php72-php-recode.x86_64 : A module for PHP applications for using the recode library
ea-php72-php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
ea-php72-php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
ea-php72-php-sockets.x86_64 : A module for PHP applications that need low-level access to sockets
ea-php72-php-tidy.x86_64 : Standard PHP module provides tidy library support
ea-php72-php-xml.x86_64 : A module for PHP applications which use XML
ea-php72-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
ea-php72-php-zip.x86_64 : A module for PHP applications that need to handle .zip files

  Name and summary matches only, use "search all" for everything.

答え1

この試み:

yum install php73.x86_64 ea-php73-php-intl.x86_64

yum install php73.x86_64 ea-php73-php-soap.x86_64

yum install php73.x86_64 ea-php73-php-zip.x86_64

など。

答え2

RemiリポジトリをさまざまなバージョンのPHPインストール用のデフォルトリポジトリとして有効にするには、yum-config-managerを使用します。次の例では、Remiリポジトリを有効にします。

Yum インストール http://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum-config-manager --remi-php73を有効にする

PHP 73のインストール例とすべての必須モジュールは、PHP 73のインストール時にインストールされます。 PHP 7.3 には次のパッケージが必要です。

ヤムインストールPHP php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

答え3

次のコマンドを実行します。

yum install php70 php70-mcrypt php70-cli php70-gd php70-curl php70-mysql php70-ldap php70-zip php70-fileinfo

そして確認

答え4


異なるバージョンのPHPをインストールするには、centos 7で以下の手順に従ってください。


Yumリポジトリの設定 まず、システムでRemiおよびEPEL yumリポジトリを有効にする必要があります。 CentOS および Red Hat 7/6 システムに EPEL リポジトリをインストールするには、次のコマンドを使用します。

このコマンドを使用して、システムにEPEL yumリポジトリをインストールします。

 sudo yum install epel-release

OSのバージョンに応じて、次のいずれかのコマンドを実行してRemiリポジトリをインストールします。

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

CentOSへのPHP 7インストールシステムは、yumリポジトリからPHPをインストールする準備が整いました。次のいずれかのコマンドを使用して、要件に応じてシステムにPHP 7.4、PHP 7.3、PHP 7.2、またはPHP 7.1をインストールします。

PHP 7.4のインストール

yum --enablerepo=remi-php74 install php

PHP 7.3のインストール

yum --enablerepo=remi-php73 install php

PHP 7.2のインストール

yum --enablerepo=remi-php72 install php

PHP 7.1のインストール

yum --enablerepo=remi-php71 install php

私のシステムに最新バージョンのPHP 7.4をインストールしました。次に、次のコマンドを実行して、自分のシステムで現在アクティブなPHPのバージョンを確認します。

php -v

PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

PHPモジュールの取り付け アプリケーションの要件によっては、他のPHPモジュールをインストールする必要があるかもしれません。次のコマンドは、より便利なPHPモジュールのいくつかをインストールします。

PHP 7.4の場合

yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

PHP 7.3の場合

yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

PHP 7.2の場合

yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

PHP 7.1の場合

yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

関連情報