How to roll back previous version and prevent PHP upgrades during regular YUM executions on the server

Refers to:

  • Plesk 11.5 for Linux

Created:

2016-11-16 13:17:43 UTC

Modified:

2016-12-21 20:23:18 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to roll back previous version and prevent PHP upgrades during regular YUM executions on the server

Symptoms

PHP was upgraded on the server though nobody explicitly launched the PHP update. Websites are not adopted to a new version and fail to load.

Third party repositories like 'atomic' or 'remi' are installed on the server:

[root@root ~]# find /etc/yum.repos.d/ -name '*.repo'|grep -v CentOS
/etc/yum.repos.d/rpmforge.repo
/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/atomic.repo

Cause

A lot of rpm packages depend on PHP, so any modification to PHP-dependent packages can lead to PHP upgrade since a newer version is available in the custom repository.

For example, this might happen in case if you execute yum for 'mysql' packages.

Resolution

Though Plesk Panel itself supports third party repositories, you should be careful installing a newer PHP versions from them, because there are a lot of differencies in PHP 5.x and 5.4, which may affect the operation of the websites that use PHP.

In order to roll bacl PHP from base repository and prevent it from upgrade, pelase use the following instructions.

  1. Roll back PHP packages:

    [root@server ~]# rpm -qa --qf "%{name} \

    "|grep php|grep -v psa php-mysql php-pear php-common php-gd php-imap php-cli php-devel php-xml php-mbstring php5-ioncube-loader php-pdo php

    [root@server ~]# rpm -qa --qf "%{name} \

    "|grep php|grep -v psa > php_packages [root@server ~]# rpm -qa --qf "%{name} \"|grep php|grep -v psa |while read p;do rpm -e --nodeps $p;done warning: /etc/php.ini saved as /etc/php.ini.rpmsave

  2. Prohibit PHP and MySQL updates in the custom repositories configuration:

    find /etc/yum.repos.d/ -name '*.repo'|grep -v CentOS|while read repo;do sed -i '/gpgcheck*/ a\\exclude=php* mysql*'  $repo;done
  3. Install all the PHP packages from basic repository:

    [root@server ~]# packages=(`cat php_packages`)

    [root@server ~]# yum install `echo ${packages[@]}`
  4. Roll back the original configuration file:

    [root@server ~]#  mv /etc/php.ini.rpmsave /etc/php.ini

If you want to install a custom PHP version on your server, please use the following article:

213909265 - How to enable multiple PHP Versions in Parallels Plesk 11.5 and Plesk Automation 11.5 on Linux

Have more questions? Submit a request
Please sign in to leave a comment.