• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Upgrade and Downgrade the PHP Versions on CentOS 7.6

  • 00:43 php -v
  • 00:53 rpm -qa | grep php
  • 01:07 yum remove "php-*" -y
  • 01:19 yum --disablerepo=remi-php72 --enablerepo=remi-php73 install php php-gd php-mbstring php-mysql php-curl php-mcrypt
  • 02:02 rpm -qa | grep php
  • 02:17 yum remove "php-*" -y
  • 02:28 yum --disablerepo=remi-php73 --enablerepo=remi-php56 install php php-gd php-mbstring php-mysql php-curl php-mcrypt
  • 02:46 php -v
5659

How to Upgrade and Downgrade the php version On CentOS 7.6

PHP is a server-side scripting language which is used to develop static websites or Dynamic websites or Web applications. PHP stands for Hypertext Pre-Processor that earlier stood for personal Home Pages. PHP scripts can only be interpreted on a server that has PHP installed. This tutorial covers the tutorial about Upgrade and Downgrade the php versions of CentOS 7.6

Procedure:

check the version of PHP

Query and List all the Installed rpm packages of php

Remove the PHP Packages

Disable and Enable the required php Versions and installing the php modules as well

CHeck the version of PHP

Check the modules of PHP In The current enabled php version

Pre-requisites:

remi and yum-utils third party repositories with php installed

Before you begin, check the version of PHP you are using.

[root@linuxhelp ~]# php -v
PHP 7.2.17 (cli) (built: Apr  3 2019 10:02:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Query and list all the installed rpm packages of php7.2v.

[root@linuxhelp ~]# rpm -qa | grep php
php-mysqlnd-7.2.17-1.el7.remi.x86_64
php-pecl-zip-1.15.4-1.el7.remi.7.2.x86_64
php-json-7.2.17-1.el7.remi.x86_64
php-mbstring-7.2.17-1.el7.remi.x86_64
php-7.2.17-1.el7.remi.x86_64
php-xml-7.2.17-1.el7.remi.x86_64
php-cli-7.2.17-1.el7.remi.x86_64
php-gd-7.2.17-1.el7.remi.x86_64
php-pdo-7.2.17-1.el7.remi.x86_64
php-common-7.2.17-1.el7.remi.x86_64
php-pecl-mcrypt-1.0.2-2.el7.remi.7.2.x86_64

Upgrade from 7.2v to 7.3v:

Remove the installed php packages of 7.2v to upgrade to 7.3v.

[root@linuxhelp ~]# yum remove "php-*" -y
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:7.2.17-1.el7.remi will be erased
---> Package php-cli.x86_64 0:7.2.17-1.el7.remi will be erased
---> Package php-common.x86_64 0:7.2.17-1.el7.remi will be erased
---> Package php-gd.x86_64 0:7.2.17-1.el7.remi will be erased
---> Package php-json.x86_64 0:7.2.17-1.el7.remi will be erased
---> Package php-mbstring.x86_64 0:7.2.17-1.el7.remi will be erased
---> Package php-mysqlnd.x86_64 0:7.2.17-1.el7.remi will be erased
---> Package php-pdo.x86_64 0:7.2.17-1.el7.remi will be erased
.
.
.
Removed:
  php.x86_64 0:7.2.17-1.el7.remi                       php-cli.x86_64 0:7.2.17-1.el7.remi                
  php-common.x86_64 0:7.2.17-1.el7.remi                php-gd.x86_64 0:7.2.17-1.el7.remi                 
  php-json.x86_64 0:7.2.17-1.el7.remi                  php-mbstring.x86_64 0:7.2.17-1.el7.remi           
  php-mysqlnd.x86_64 0:7.2.17-1.el7.remi               php-pdo.x86_64 0:7.2.17-1.el7.remi                
  php-pecl-mcrypt.x86_64 0:1.0.2-2.el7.remi.7.2        php-pecl-zip.x86_64 0:1.15.4-1.el7.remi.7.2       
  php-xml.x86_64 0:7.2.17-1.el7.remi            

Disable the php 7.2v and enable the php7.3v.Install the php modules of 7.3v as well.

[root@linuxhelp ~]# yum --disablerepo=remi-php72 --enablerepo=remi-php73 install php php-gd php-mbstring php-mysql php-curl php-mcrypt
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.myfahim.com
 * epel: mirror.premi.st
 * extras: centos.myfahim.com
 * remi-php73: rpms.remirepo.net
 * remi-safe: rpms.remirepo.net
 * updates: centos.myfahim.com
remi-php73                                                                        | 3.0 kB  00:00:00     
remi-php73/primary_db                                                             | 196 kB  00:00:02  
.
.
.
Installed:
  php.x86_64 0:7.3.5-1.el7.remi                   php-common.x86_64 0:7.3.5-1.el7.remi                   
  php-gd.x86_64 0:7.3.5-1.el7.remi                php-mbstring.x86_64 0:7.3.5-1.el7.remi                 
  php-mysqlnd.x86_64 0:7.3.5-1.el7.remi           php-pecl-mcrypt.x86_64 0:1.0.2-2.el7.remi.7.3          

Dependency Installed:
  oniguruma5.x86_64 0:6.9.1-1.el7.remi                 php-cli.x86_64 0:7.3.5-1.el7.remi                
  php-json.x86_64 0:7.3.5-1.el7.remi                   php-pdo.x86_64 0:7.3.5-1.el7.remi                

Complete!

check the version of PHP again.

[root@linuxhelp ~]# php -v
PHP 7.3.5 (cli) (built: Apr 30 2019 08:37:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies

Downgrade from 7.3v to 5.6v:

Query and list the rpm packages of php

[root@linuxhelp ~]# rpm -qa | grep php
php-pdo-7.3.5-1.el7.remi.x86_64
php-mysqlnd-7.3.5-1.el7.remi.x86_64
php-json-7.3.5-1.el7.remi.x86_64
php-pecl-mcrypt-1.0.2-2.el7.remi.7.3.x86_64
php-mbstring-7.3.5-1.el7.remi.x86_64
php-7.3.5-1.el7.remi.x86_64
php-cli-7.3.5-1.el7.remi.x86_64
php-common-7.3.5-1.el7.remi.x86_64
php-gd-7.3.5-1.el7.remi.x86_64

Remove the php installed packages of 7.3v.
[root@linuxhelp ~]# yum remove "php-*" -y
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-cli.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-common.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-gd.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-json.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-mbstring.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-mysqlnd.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-pdo.x86_64 0:7.3.5-1.el7.remi will be erased
---> Package php-pecl-mcrypt.x86_64 0:1.0.2-2.el7.remi.7.3 will be erased
--> Finished Dependency Resolution
.
.
.
.
Removed:
  php.x86_64 0:7.3.5-1.el7.remi                          php-cli.x86_64 0:7.3.5-1.el7.remi              
  php-common.x86_64 0:7.3.5-1.el7.remi                   php-gd.x86_64 0:7.3.5-1.el7.remi               
  php-json.x86_64 0:7.3.5-1.el7.remi                     php-mbstring.x86_64 0:7.3.5-1.el7.remi         
  php-mysqlnd.x86_64 0:7.3.5-1.el7.remi                  php-pdo.x86_64 0:7.3.5-1.el7.remi              
  php-pecl-mcrypt.x86_64 0:1.0.2-2.el7.remi.7.3         

Complete!

Disable the 7.3version and enable the 56 version .Install the php modules of 5.6 version as well.

[root@linuxhelp ~]# yum --disablerepo=remi-php73 --enablerepo=remi-php56 install php php-gd php-mbstring php-mysql php-curl php-mcrypt
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.myfahim.com
 * epel: mirror.premi.st
 * extras: centos.myfahim.com
 * remi-php56: rpms.remirepo.net
 * remi-php72: rpms.remirepo.net
 * remi-safe: rpms.remirepo.net
 * updates: centos.myfahim.com
remi-php56                                                                        | 3.0 kB  00:00:00     
remi-php56/primary_db                                                             | 246 kB  00:00:02     
.
.
.
Installed:
  php.x86_64 0:5.6.40-8.el7.remi                     php-common.x86_64 0:5.6.40-8.el7.remi               
  php-gd.x86_64 0:5.6.40-8.el7.remi                  php-mbstring.x86_64 0:5.6.40-8.el7.remi             
  php-mcrypt.x86_64 0:5.6.40-8.el7.remi              php-mysqlnd.x86_64 0:5.6.40-8.el7.remi              

Dependency Installed:
  php-cli.x86_64 0:5.6.40-8.el7.remi                   php-pdo.x86_64 0:5.6.40-8.el7.remi                
  php-pecl-jsonc.x86_64 0:1.3.10-2.el7.remi.5.6        php-pecl-zip.x86_64 0:1.15.4-1.el7.remi.5.6       
  t1lib.x86_64 0:5.1.2-14.el7                         

Complete!

Check the version of PHP now.

[root@linuxhelp ~]# php -v
PHP 5.6.40 (cli) (built: Apr 30 2019 11:35:35) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Therefore, you have both upgraded and downgraded your PHP version on CentOS 7.6.

Tags:
jacob
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is the command to check the php modules On CentOS 7.6?

A

php -m is the command to check the php modules on CentOS 7.6

Q

What is the command to check the version of php on CentOS 7.6?

A

php -v is the command to check the version of php on CentOS 7.6

Q

What are the third repositories that are required to install php?

A

epel and remi-repositories are the third party repositories required to install php.

Q

How to disable the php7.2 version On CentOS 7.6?

A

yum --disablerepo=remi-php72 is the command to disable the php7.2v On CentOS 7.6

Q

How to enable the php71 version On CentOS 7.6?

A

yum --enablerepo=remi-php71 is the command to enable the php71 version On CentOS 7.6

Related Tutorials in How to Upgrade and Downgrade the PHP Versions on CentOS 7.6

Related Tutorials in How to Upgrade and Downgrade the PHP Versions on CentOS 7.6

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Upgrade and Downgrade the PHP Versions on CentOS 7.6

Related Forums in How to Upgrade and Downgrade the PHP Versions on CentOS 7.6

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019

Related News in How to Upgrade and Downgrade the PHP Versions on CentOS 7.6

Related News in How to Upgrade and Downgrade the PHP Versions on CentOS 7.6

PHP7 bugs used by hackers to remotely hijack web servers
PHP7 bugs used by hackers to remotely hijack web servers
Nov 5, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ryan ?
how to use visual traceroute tool

Am using traceroute command to check for the route. i got this tool while surfing. So pls help me out installation and usage of Visual traceroute tool.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.