Ubuntu - disable upgrade from php 7.0 to 7.1 when using apt update/upgrade

Asked by Costin on 2017-01-07

Is there a way to disable automatic upgrade from php 7.0 to 7.1 when using apt update/upgrade.

New changes in Ondrej PPA for PHP triggers the upgrade of php 7.0 to 7.1
This may be an issue for apps runing on php 7.0 that are not fully ported and may completely break on php 7.1

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:

This question was reopened

You can use apt-pinning to stop any package updating.

Manfred Hampl (m-hampl) said : #2

The package management tools allow to fix the 7.0 version to keep that version even if upgrades would be available.
(commands like "sudo apt-mark hold php" or "echo php hold | sudo dpkg --set-selections", please look at the man pages or search other information sources for details)

Costin (manyk) said : #3

Well, I need further updates for php 7.0 but not an upgrade from 7.0 to 7.1 as the automatic update tries now.
In this case maybe pinning or holding does not help.

# apt list --upgradable
php-cli/xenial 1:7.1+49+deb.sury.org~xenial+3 all [upgradable from: 1:7.0+49+deb.sury.org~xenial+1]
php-common/xenial 1:49+deb.sury.org~xenial+3 all [upgradable from: 1:49+deb.sury.org~xenial+1]
php-soap/xenial 1:7.1+49+deb.sury.org~xenial+3 all [upgradable from: 1:7.0+49+deb.sury.org~xenial+1]

Manfred Hampl (m-hampl) said : #5

If the PPA offers already an upgrade from 1:7.0+49+deb.sury.org~xenial+1 to 1:7.1+49+deb.sury.org~xenial+3 (taking php-cli as an example), then I would not expect any further updates for the 7.0 version of that package.

For diagnostic purposes and to see which PPAs and packages are involved, what is the output of the command
apt-cache policy php-cli php-common php-soap

You are referring to software from a PPA which lies fully in the responsibility of the PPA provider.
I suggest that you contact him with your question.

Ondřej Surý (ondrej) said : #7

Instead of pinning, you should specify the exact version numbers in package names when installing PHP package. E.g. if you want to stay on PHP 7.0, use `apt-get install --no-recommends php7.0-fpm`. The versionless packages are meant to depend on latest stable PHP version.

Costin (manyk) said : #9

Thanks for the tip Ondrej. So far, running 'apt-get install php7.0-fpm' did the trick.