• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News 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
{{postValue.id}}

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
{{postCtrl.cmtErrMsg}}

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

Back To Top!
Rank
User
Points

Top Contributers

userNameayanbhatti
76995

Top Contributers

userNamenaveelansari
49800

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
30920

Top Contributers

userNamemuhammadali
22950
Can you help clopas kwenda ?
Wifi connection

l have recently installed linux centos 6.0, l failing to install drivers for wireless internet connection

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
© 2023 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.