Linux serverNETWORK ADMINISTRATIONS

How to upgrade PHP version on CentOS 7

This tutorial will show you how to upgrade PHP 5.4 to PHP 7.4 on CentOS 7.

Actual guide: https://unihost.com/help/how-to-update-php-centos-7/

To install PHP type the next command:
# yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

Type the following command to see the current PHP version:
# php -v

PHP 5.4.16 (cli) (built: Nov 1 2019 16:04:20)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

As you can see the default PHP version is 5.4, and now we will update it.

Turn on Remi repo:
# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Install yum-utils packages:
# yum install yum-utils

The yum-utils package includes yum-config-manager, which you can use to enable Remi repo as the default repository for installing different PHP versions.

If you want to install PHP 7.1, PHP 7.2, PHP 7.3, or PHP 7.4 on CentOS 7, just enable it as below.
# yum-config-manager –enable remi-php71
# yum-config-manager –enable remi-php72
# yum-config-manager –enable remi-php73
# yum-config-manager –enable remi-php74

For this tutorial, I will choose PHP 7.4
# yum-config-manager –enable remi-php74

Now you should refresh the repository:
# yum update

Checking PHP version one more time:
# php -v

PHP 7.4.2 (cli) (built: Jan 21 2020 11:35:20) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

And there you have it, PHP 7.4 installed and running on a CentOS 7 server.

#Unihost #PHP #yum #utils #yum #config #manager #version #CentOS #CentOS7 #Guide

source

centos 7

Leave a Reply

Your email address will not be published. Required fields are marked *