Home > Backend Development > PHP Tutorial > How to install php7 with yum under Centos?

How to install php7 with yum under Centos?

一个新手
Release: 2023-03-16 13:36:01
Original
8627 people have browsed it

How to install php7 with yum under Centos?

How to install php7 under yum in Centos?

1. Installation source

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

How to install php7 with yum under Centos?

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

How to install php7 with yum under Centos?

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
Copy after login
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
Copy after login

2. Clear historical versions

In order to prevent

php conflicts from happening on centos, so this command should be done first It would be better to implement it.

yum -y remove php*
Copy after login

3. Install php7 and various extensions

In fact, there are many corresponding extension libraries here, everyone must pay attention here

cli These two packages are and fpm, and other related packages depend on your needs.

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel
Copy after login
There is also a more luxurious version:

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
Copy after login

4. After the installation is completed, start the service

systemctl enable php-fpm.service
systemctl start php-fpm.service
Copy after login

5. The installation is successful

For more related knowledge, please visit

PHP Chinese website! !

The above is the detailed content of How to install php7 with yum under Centos?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template