Home >Operation and Maintenance >CentOS >How to use yum to install php7.2 on centos7

How to use yum to install php7.2 on centos7

王林
王林Original
2020-04-25 09:29:412557browse

How to use yum to install php7.2 on centos7

1. Installation source

To install php7.2, you need to configure an additional yum source address, otherwise an error will be reported and the relevant software package cannot be found.

The yum source address of the higher version of php has two parts, one part is epel-release and the other part comes from webtatic. If epel-release is skipped, an error will pop up when installing webtatic.

So, the command required here is:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Of course, you can also choose the following command, which will have the same effect.

yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

(Recommended related video tutorials: linux video tutorial)

2. Clear historical versions

In order to prevent php conflicts on centos , so it is better to execute this command first.

yum -y remove php*

3. Install the expansion package

In fact, there are many corresponding expansion libraries. Here you must pay attention to the two packages cli and fpm, and other related packages It depends on what you need.

# php72w-mysql.x86_64 是mysqli扩展
yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-mysql.x86_64

4. After the installation is completed, start the service

systemctl enable php-fpm.service
systemctl start php-fpm.service

5. The installation is successful

[root@sz_sjzx_cbslog01_10_207 scripts]# php -v
PHP 7.2.24 (cli) (built: Oct 26 2019 12:28:19) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Recommended tutorial: centos tutorial

The above is the detailed content of How to use yum to install php7.2 on centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn