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

How to recompile Nginx and add modules

When compiling and installing Nginx, some modules...

Three ways to implement virtual hosts under Linux7

1. Same IP address, different port numbers Virtua...

Samba server configuration under Centos7 (actual combat)

Samba Overview Samba is a free software that impl...

Detailed explanation of webpage screenshot function in Vue

Recently, there is a requirement for uploading pi...

Example code of html formatting json

Without further ado, I will post the code for you...

Summary of the differences between count(*), count(1) and count(col) in MySQL

Preface The count function is used to count the r...

What kinds of MYSQL connection queries do you know?

Preface If the query information comes from multi...

About the problem of no virtual network card after VMware installation

1 Problem description: 1.1 When VMware is install...

Vue3+script setup+ts+Vite+Volar project

Table of contents Create a vue + ts project using...

Ubuntu basic settings: installation and use of openssh-server

Record the installation and use of openssh-server...

MySQL database JDBC programming (Java connects to MySQL)

Table of contents 1. Basic conditions for databas...

Study notes to write the first program of Vue

Table of contents 1. Write an HTML, the first Vue...

Specific use of Linux which command

We often want to find a file in Linux, but we don...

Detailed explanation of how to use the vue verification code component

This article example shares the specific implemen...