1

I am maintaining 3 webservers all running Ubuntu 16.04. At the moment we are trying to migrate from php-memcache to php-memcached prior to upgrading the servers to 18.04 and possibly 20.04.

I have successfully installed php-memcached on 1 of the 3 webservers, but the two others are giving me a dependency error.

# apt-get install php-memcached

[...]
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been create or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
php-memcached: Depends: php-common (>= 1:7.0+33~) but it is not going to be installed

Depends: phpapi-20151012
E: Unable to correct problems, you have held broken packages.

Tried an update -> dist-upgrade and reboot, but this has not solved the issue.

These are the repositories according to apt-get update:

# apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease                            
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Fetched 325 kB in 0s (364 kB/s)             

It seems that the trouble is with phpapi-20151012

# apt-get -o Debug::pkgProblemResolver=yes install phpapi-20151012
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package phpapi-20151012 is a virtual package provided by:
  php7.0-phpdbg 7.0.33-0ubuntu0.16.04.15
  php7.0-fpm 7.0.33-0ubuntu0.16.04.15
  libphp7.0-embed 7.0.33-0ubuntu0.16.04.15
  php7.0-cli 7.0.33-0ubuntu0.16.04.15
  php7.0-cgi 7.0.33-0ubuntu0.16.04.15
  libapache2-mod-php7.0 7.0.33-0ubuntu0.16.04.15
You should explicitly select one to install.

E: Package 'phpapi-20151012' has no installation candidate

As I understand the above message phpapi-20151012 should be provided with one of the packages listed. I have 2 of those installed, but still no phpapi. So i tried installing one that I don't have, and that didn't work either.

It seems that the php-common package is okay:

# apt-get -o Debug::pkgProblemResolver=yes install php-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php-common is already the newest version (1:62+ubuntu14.04.1+deb.sury.org+1).
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I have also noticed that the php 7.1 packages seems to be leftovers from Ubuntu 14:

php7.1-cli/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-common/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-json/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-opcache/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]
php7.1-readline/now 7.1.19-1+ubuntu14.04.1+deb.sury.org+1 amd64 [installed,local]

Apache is using php 7.0 and the cli is using 7.1 ... So as a start I have downgraded php cli to 7.0:

# update-alternatives --config php
There are 3 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/php7.1   71        auto mode
  1            /usr/bin/php5.6   56        manual mode
  2            /usr/bin/php7.0   70        manual mode
  3            /usr/bin/php7.1   71        manual mode

Press <enter> to keep the current choice[*], or type selection number: 2

# update-alternatives --config php
There are 3 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php7.1   71        auto mode
  1            /usr/bin/php5.6   56        manual mode
* 2            /usr/bin/php7.0   70        manual mode
  3            /usr/bin/php7.1   71        manual mode

Press <enter> to keep the current choice[*], or type selection number: 

Next I have removed the 7.1 packages:

apt-get remove php7.1-cli
apt-get autoremove

After that all php7.1 packages were gone

Then tried this:

apt-get update --fix-missing
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease                            
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [802 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [723 kB]
Fetched 1,850 kB in 1s (1,091 kB/s)                      
Reading package lists... Done

# apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Still no luck... I have no idea. Any suggestions?


UPDATE:

As requested in the comments:

# apt policy php-common
php-common:
  Installed: 1:62+ubuntu14.04.1+deb.sury.org+1
  Candidate: 1:62+ubuntu14.04.1+deb.sury.org+1
  Version table:
 *** 1:62+ubuntu14.04.1+deb.sury.org+1 100
        100 /var/lib/dpkg/status
     1:35ubuntu6.1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages
     1:35ubuntu6 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages
4
  • Did you try running apt-get install php-memcached again after removing the 7.1 packages? apt-get install -f wouldn’t try re-installing it. Aug 5, 2020 at 7:49
  • Yes i tried that after every step
    – Jette
    Aug 5, 2020 at 7:54
  • @Jette based on the apt policy output we can assume that you have third-party packages installed. However, according to your apt-get update output these package repos seem to be no longer active. You'll want to check /etc/apt/sources.list and /etc/apt/sources.list.d to check for something containing sury. The tag on the version of those PHP 7.1 packages suggests this is a third-party package repo, although I wouldn't know whether that is/was tied to 14.04 or 16.04. Your information seems to suggest that there may be a locally configured package repo (somewhere in your FS). Aug 5, 2020 at 8:34
  • /etc/apt# grep -rIi sury * does not output anything...
    – Jette
    Aug 5, 2020 at 8:40

1 Answer 1

2

There’s still at least one remnant of the PHP 7.1 packages, php-common; you need to downgrade that to the version available in the Ubuntu repositories:

apt install php-common=1:35ubuntu6.1
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .