linux 安装 php 任意版本

ubuntu

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

For PHP 5.5.36

sudo apt-get install php5.5

For PHP 5.6.22

sudo apt-get install php5.6

To verify the version installed, run the following command:

sudo php -v

If you want to remove PHP installed, then run the following commands:

sudo apt-get update
sudo apt-get purge php5-common -y
sudo apt-get --purge autoremove -y

centos

# 安装yum-utils并启用EPEL存储库
yum install epel-release yum-utils -y
# 下载并安装remirepo
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
# 配置PHP 7.0存储库
yum-config-manager --enable remi-php70
# 配置PHP 7.1存储库
yum-config-manager --enable remi-php71
# 配置PHP 7.2存储库
yum-config-manager --enable remi-php72
# 安装PHP 7.2以及依赖项
yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y
# 搜索所有PHP模块
yum search php | more

发表评论

电子邮件地址不会被公开。 必填项已用*标注

17 + 8 =