要安装其他版本的 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

使用 yum-config-manager 启用 Remi 存储库作为安装 PHP 不同版本的默认存储库。以下示例用于启用 Remi 存储库。

百胜安装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

现在根据您的操作系统版本执行以下命令之一来安装 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

相关内容