登陆阿里云ECS
先安装几个常用的工具
yum update
yum install zip
yum install unzip
yum install nginx
PHP7.4的下载地址:https://centos.pkgs.org/7/remi-x86_64/php74-1.0-1.el7.remi.x86_64.rpm.html
dnf install https://dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
可能会提示-bash: dnf: command not found
使用yum安装一下即可:
yum install dnf
检查epel库是否存在
rpm -qa | grep epel
dnf install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
检查存储库
rpm -qa | grep remi
yum --enablerepo=remi install php74
Dependencies Resolved
==========================================================================================================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================================================================================================
Installing:
php74 x86_64 1.0-1.el7.remi remi 2.4 k
Installing for dependencies:
audit-libs-python x86_64 2.8.5-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
environment-modules x86_64 3.2.10-10.el7 base 107 k
libcgroup x86_64 0.41-21.el7 base 66 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
php74-php-cli x86_64 7.4.1-1.el7.remi remi 3.4 M
php74-php-common x86_64 7.4.1-1.el7.remi remi 677 k
php74-php-json x86_64 7.4.1-1.el7.remi remi 71 k
php74-runtime x86_64 1.0-1.el7.remi remi 1.1 M
policycoreutils-python x86_64 2.5-33.el7 base 457 k
python-IPy noarch 0.75-6.el7 base 32 k
scl-utils x86_64 20130529-19.el7 base 24 k
setools-libs x86_64 3.3.8-4.el7 base 620 k
tcl x86_64 1:8.5.13-8.el7 base 1.9 M
Transaction Summary
==========================================================================================================================================================================================================
Install 1 Package (+14 Dependent packages)
Installed:
php74.x86_64 0:1.0-1.el7.remi
Dependency Installed:
audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7 environment-modules.x86_64 0:3.2.10-10.el7 libcgroup.x86_64 0:0.41-21.el7
libsemanage-python.x86_64 0:2.5-14.el7 php74-php-cli.x86_64 0:7.4.1-1.el7.remi php74-php-common.x86_64 0:7.4.1-1.el7.remi php74-php-json.x86_64 0:7.4.1-1.el7.remi
php74-runtime.x86_64 0:1.0-1.el7.remi policycoreutils-python.x86_64 0:2.5-33.el7 python-IPy.noarch 0:0.75-6.el7 scl-utils.x86_64 0:20130529-19.el7
setools-libs.x86_64 0:3.3.8-4.el7 tcl.x86_64 1:8.5.13-8.el7
Complete!
完装完成后,检查PHP版本
[root@iZwzccdsewe7beg7qmq7v4Z ~]# php74 -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