Tutorial on installing PHP on centos via yum

Tutorial on installing PHP on centos via yum

First, let me introduce how to install PHP on CentOS 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 the execution process

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 and enter php -version to view the php version

ps: Let's take a look at the steps to install PHP7.2 with Yum under CentOS 7

1. Installation source

To install php72w, you need to configure additional yum source addresses, 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 is epel-release and the other is from webtatic. If you skip epel-release, you will get an error when installing webtatic.

So, the command needed 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 command below, which will have the same effect.

yum install epel-release -y

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

2. Clear historical versions

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

yum -y remove php*

3. Install the extension pack

In fact, there are many corresponding extension libraries here. Here you must pay attention to the two packages of cli and fpm, and other related packages depend on your needs.

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.service

systemctl start php-fpm.service

5. Installation successful

Summarize

The above is the tutorial on how to install PHP on CentOS through Yum introduced by the editor. I hope it will be helpful to everyone!

You may also be interested in:
  • Detailed steps to install MySQL 5.7 via YUM on CentOS7
  • CentOS 6-7 yum installation method of PHP (recommended)
  • Tutorial on installing rabbitmq using yum on centos8
  • How to install mongodb 4.2 using yum on centos8
  • Detailed explanation of configuring Docker's yum source and installing it in CentOS7
  • Detailed tutorial on how to install PHP7.2 in Centos7 Yum
  • How to install mysql via yum on centos7
  • How to install rabbitmq-server using yum on centos

<<:  About VUE's compilation scope and slot scope slot issues

>>:  MySQL 8.0.17 winx64 (with navicat) manual configuration version installation tutorial diagram

Recommend

Docker deploys Laravel application to realize queue & task scheduling

In the previous article, we wrote about how to de...

React Fragment Introduction and Detailed Usage

Table of contents Preface Motivation for Fragment...

How to use docker to deploy front-end applications

Docker is becoming more and more popular. It can ...

How to add and delete unique indexes for fields in MySQL

1. Add PRIMARY KEY (primary key index) mysql>A...

Detailed steps to delete environment variables in Linux

How to delete environment variables in Linux? Use...

MySQL 8.0.13 installation and configuration method graphic tutorial under win10

I would like to share the installation and config...

Example to explain the size of MySQL statistics table

Counting the size of each table in each database ...

An article to solve the echarts map carousel highlight

Table of contents Preface toDoList just do it Pre...

HTML+Sass implements HambergurMenu (hamburger menu)

A few days ago, I watched a video of a foreign gu...

VMware virtualization kvm installation and deployment tutorial summary

Virtualization 1. Environment Centos7.3 Disable s...

Detailed steps to install web server using Apache httpd2.4.37 on centos8

Step 1: yum install httpd -y #Install httpd servi...

Web project development VUE mixing and inheritance principle

Table of contents Mixin Mixin Note (duplicate nam...

10 tips for designing useful, easy-to-use web applications

Here are 10 tips on how to design better-usable w...