I have a mission-critical production CentOS server running PHP7.1 from the remi repo. I need to downgrade PHP to 7.0. How can I do safely do this (What commands) with no downtime? Here's some output to provide some context.
# yum info php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.linux.duke.edu
* epel: fedora-epel.mirrors.tds.net
* extras: mirror.linux.duke.edu
* remi-php71: remi.mirror.wearetriple.com
* remi-safe: remi.mirror.wearetriple.com
* updates: mirror.es.its.nyu.edu
Installed Packages
Name : php
Arch : x86_64
Version : 7.1.12
Release : 4.el7.remi
Size : 9.4 M
Repo : installed
From repo : remi-php71
Summary : PHP scripting language for creating dynamic web sites
How I originally upgraded to PHP7.1 was by enabling the remi php7.1 repo for PHP so now printing info for just php
package shows the php7.1 package info as seen above. What I need is for yum info php
to return the php 7.0 package that can be found in remi's php70
package:
# yum info php70
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.linux.duke.edu
* epel: fedora-epel.mirrors.tds.net
* extras: mirror.linux.duke.edu
* remi-php71: remi.mirror.wearetriple.com
* remi-safe: remi.mirror.wearetriple.com
* updates: mirror.es.its.nyu.edu
Available Packages
Name : php70
Arch : x86_64
Version : 1.0
Release : 5.el7.remi
Size : 2.9 k
Repo : remi-safe
Summary : Package that installs PHP 7.0
License : GPLv2+
Description : This is the main package for php70 Software Collection,
: that install PHP 7.0 language.
What commands would accomplish that and replace php7.1 with php7.0?
You should be able to achieve this with
yum downgrade
. The command in your case should be something likewhich will give you the actions that yum will do and the option to proceed. You may have to do
if the first command doesn't show a downgrade path.
As always, test this before doing it on a production machine.
You could try to check yum history with
yum history
command. If you find step, where you install PHP7.1 instead of PHP7.0, you could revert it byyum history undo <Step ID>
.This should work to downgrade most PHP-versions installed using the remi-repo.
You probably already have remi-php71.repo and remi-php70.repo in etc/yum.repos.d/ If you don't have a repo file for the version you want to downgrade to, make sure to install that first.
Disable the current version by editing the file for that version (remi-php71.repo) and changing
enabled=1
toenabled=0
Enable the version you want to downgrade to by editing the file for that version (remi-php70.repo) and changing the first
enabled=0
toenabled=1
(attention: only the first one, don't accidentally enable to one under debuginfo or test)Then:
You'll probably receive a number of messages like this one
Based on that error, you should add php-common to your command:
extra errors will probably be returned, which will include other packages that need to be included in your yum downgrade command. Keep adding them to the list. After a couple of attempts, yum should be happy to actually carry out the downgrade.
Check if it was successful:
Don't forget to restart php-fpm if you use this.