Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos tutorials for installing php through yum

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

First of all, I will introduce centos to install php through yum.

1. Add php's yum software repository

Sudo rpm-Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

2. Install php-related software, and select yes during execution.

Sudo yum install php71w.x86_64 php71w-cli.x86_64 php71w-common.x86_64 php71w-gd.x86_64 php71w-ldap.x86_64 php71w-mbstring.x86_64 php71w-mcrypt.x86_64 php71w-mysql.x86_64 php71w-pdo.x86_64

3. Install php71-fpm

Sudo yum install php71w-fpm.x86_64

Wait for the installation to complete, enter php-version to view the php version

Ps: let's take a look at the steps for installing PHP7.2 in Yum under CentOS 7.

1. Installation source

To install php72w, you need to configure an additional yum source address, otherwise you will report an error and cannot find the relevant software package.

The yum source address of the higher version of php, which has two parts, one is epel-release and the other is from webtatic. If you skip epel-release, there will be an error when installing webtatic.

So, the commands you need here are:

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 has the same effect.

Yum install epel-release-y

Rpm-Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2. Clear the historical version

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

Yum-y remove php*

3. Install the expansion pack

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

Yum-y install php72w php72w-cli php72w-fpm php72w-common php72w-devel

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

4. After the installation is complete, start the service

Systemctl enable php-fpm.servicesystemctl start php-fpm.service

5. Installation succeeded

Summary

The above is introduced to you by the editor of the centos through yum installation of php tutorials, I hope to help you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 258

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report