Hamsa K
Editor
5 min read | 5 years ago

How to Downgrade php 7.2 to 7.1 in centos

How to downgrade php version in centos

If you are running centos.x machine with the Remi’s RPM repositories.

if you don't have follow below link to install Remi repository.

First it would be better to backup your   file and if we’re using the php-fpm Fastcgi extension – the folder.

  • Open a terminal window.
  • Identify the PHP packages you need to uninstall with the following command:  .
  • Take a note and/or make a screenshot of all the package you need – as you’ll have to reinstall them later on.
  • Remove the installed PHP 7.2 packages along with all their dependencies by following command.
  • yum remove php7.2-*
  • Install the PHP 7.1 packages with the following command
[root@lampblogs ~]# yum --disablerepo=remi-php72 --enablerepo=remi-php71 install php php-common php-devel php-bcmath php-gd php-pdo php-pear php-mysqlnd php-mbstring php-xml php-tidy php-soap

 Once all packages are installed check php version by like below.

[root@lampblogs ~]# php -v
PHP 7.1.30 (cli) (built: May 28 2019 12:49:01) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

Now php is downgraded sucessfully.Then restore our previous setup as below.

  • Restore your previous   file from the backup you taken.
  • In case if you are using the php-fpm fastcgi extension, you also have to restore your previous   folder from the backup and start-enable the php-fpm service.
systemctl start php-fpm
systemctl enable php-fpm

Finally don't forget to restart Apache service.

[root@lampblogs ~]# systemctl restart httpd

 



Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy