Detail the two ways of installing PHP under Centos

  • 2020-06-15 10:57:26
  • OfStack

When installing PHP under Centos, there are two ways to implement it, which are summarized for record.

Abstract

General Centos under the installation software we use 源码 To install or RPM包 The way to install it is sometimes simpler and we can adopt it YUM源 The way of

A special place to install PHP is to have two YUM sources to choose from

Webtatic mode install upgrade PHP

The installation webtatic The source


[root@i-bskmtj6q ~]# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
Retrieving https://mirror.webtatic.com/yum/el6/latest.rpm
Preparing...        ########################################### [100%]
  1:webtatic-release    ########################################### [100%]
[root@i-bskmtj6q ~]# ls -l /etc/yum.repos.d/webtatic*
-rw-r--r-- 1 root root 963 Nov 13 2016 /etc/yum.repos.d/webtatic-archive.repo
-rw-r--r-- 1 root root 865 Nov 13 2016 /etc/yum.repos.d/webtatic.repo
-rw-r--r-- 1 root root 963 Nov 13 2016 /etc/yum.repos.d/webtatic-testing.repo

Install or upgrade PHP


## install 
yum --enablerepo=remi install php php-* 
## update
yum --enablerepo=remi update php php-*

REMI mode install upgrade PHP

There's a REMI sources 特殊 Must be installed before installing it


[root@i-bskmtj6q ~]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Retrieving http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
error: Failed dependencies:
  epel-release = 6 is needed by remi-release-6.9-1.el6.remi.noarch

Install REMI source


[root@i-bskmtj6q ~]# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Preparing...        ########################################### [100%]
  1:epel-release      ########################################### [100%]
[root@i-bskmtj6q ~]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Retrieving http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Preparing...        ########################################### [100%]
  1:remi-release      ########################################### [100%]
[root@i-bskmtj6q ~]# ls -l /etc/yum.repos.d/remi*
-rw-r--r-- 1 root root 457 Jun 30 20:13 /etc/yum.repos.d/remi-php54.repo
-rw-r--r-- 1 root root 1316 Jun 30 20:13 /etc/yum.repos.d/remi-php70.repo
-rw-r--r-- 1 root root 1316 Jun 30 20:13 /etc/yum.repos.d/remi-php71.repo
-rw-r--r-- 1 root root 1316 Jun 30 20:13 /etc/yum.repos.d/remi-php72.repo
-rw-r--r-- 1 root root 2609 Jun 30 20:13 /etc/yum.repos.d/remi.repo
-rw-r--r-- 1 root root 751 Jun 30 20:13 /etc/yum.repos.d/remi-safe.repo

Install or upgrade PHP


## install 
yum --enablerepo=webtatic install php php-* 
## update
yum --enablerepo=webtatic update php php-*

instructions

1, EPEL

Extra Packages for Enterprise Linux, which is an extended software source for enterprise Linux, suitable for RHEL, CentOS, Scientific Linux system.

2, remi

The software source provides up-to-date software support for older VERSIONS of fedora as well as for Centos and RHEL

The icon on the official website may be mainly related to the installation and upgrade of PHP (personal guess).

3, Webtatic

The Webtatic repository a CentOS/RHEL containing web related packages

Website reference https: / / webtatic com/projects/yum repository /


Related articles: