1

I am facing an issue about mismatch between last updated package of PHP and what is actually run.

Recently I have updated my Ubuntu server by running:

apt-get update && apt-get upgrade

On the output I have noticed the right package version was installed:

Unpacking php7.1-fpm (7.1.33-1+ubuntu18.04.1+deb.sury.org+1) over (PHP Version 7.1.25-1+ubuntu18.04.1+deb.sury.org+1) ...

I have controlled the installed version by running following command:

apt-cache madison php7.1-fpm
php7.1-fpm | 7.1.33-1+ubuntu18.04.1+deb.sury.org+1 | http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages

But when I run phpinfo() from php-fpm socket, I still see the previous installed version:

PHP Version 7.1.25-1+ubuntu18.04.1+deb.sury.org+1

What I have tried?

  • To restart php7.1-fpm.
  • To restart Nginx (which is in top of PHP fpm).

EDIT 1

$ which php
/usr/bin/php

$ ls -al /usr/bin | grep php
php -> /etc/alternatives/php
php7.1

$ ls -al /etc/alternatives | grep php 
php -> /usr/bin/php7.1
php.1.gz -> /usr/share/man/man1/php7.1.1.gz

$ /usr/bin/php7.1 -v
PHP 7.1.25-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Dec  7 2018 08:15:52) ( NTS )

EDIT 2

$ dpkg -l 'php*'|grep ^ii
ii  php-common         2:69+ubuntu18.04.1+deb.sury.org+2+php7.3   all          Common files for PHP packages
ii  php-geoip          1.1.1-2+ubuntu18.04.1+deb.sury.org+10      amd64        GeoIP module for PHP
ii  php-igbinary       3.0.1+2.0.8-1+ubuntu18.04.1+deb.sury.org+1 amd64        igbinary PHP serializer
ii  php-memcached      3.1.3+2.2.0-1+ubuntu18.04.1+deb.sury.org+1 amd64        memcached extension module for PHP, uses libmemcached
ii  php-msgpack        2.0.3+0.5.7-1+ubuntu18.04.1+deb.sury.org+1 amd64        PHP extension for interfacing with MessagePack
ii  php-redis          5.0.2+4.3.0-2+ubuntu18.04.1+deb.sury.org+1 amd64        PHP extension for interfacing with Redis
ii  php7.1             7.1.33-1+ubuntu18.04.1+deb.sury.org+1      all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.1-cli         7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        command-line interpreter for the PHP scripting language
ii  php7.1-common      7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        documentation, examples and common module for PHP
ii  php7.1-curl        7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        CURL module for PHP
ii  php7.1-fpm         7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.1-gd          7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        GD module for PHP
ii  php7.1-gmp         7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        GMP module for PHP
ii  php7.1-intl        7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        Internationalisation module for PHP
ii  php7.1-json        7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        JSON module for PHP
ii  php7.1-mbstring    7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        MBSTRING module for PHP
ii  php7.1-mcrypt      7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        libmcrypt module for PHP
ii  php7.1-mysql       7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        MySQL module for PHP
ii  php7.1-opcache     7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        Zend OpCache module for PHP
ii  php7.1-readline    7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        readline module for PHP
ii  php7.1-sqlite3     7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        SQLite3 module for PHP
ii  php7.1-xml         7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  php7.1-zip         7.1.25-1+ubuntu18.04.1+deb.sury.org+1      amd64        Zip module for PHP
5
  • 1
    Can you post the output of which php?
    – HawkEye
    Oct 29, 2019 at 6:23
  • i have updated my post, it is for php cli which have the same original issue than php7.1-fpm
    – Yanis-git
    Oct 29, 2019 at 6:30
  • Could you please show the output of dpkg -l 'php*'|grep ^ii ?
    – jollyroger
    Oct 29, 2019 at 7:21
  • I have updated my post, i have may find someting.
    – Yanis-git
    Oct 29, 2019 at 7:24
  • @jollyroger thx for your help, after forcing upgrade of all sub package, all was good.
    – Yanis-git
    Oct 29, 2019 at 8:50

2 Answers 2

1

The list of installed packages shows only php7.1 to be of version 7.1.33 but all subpackages aren't upgraded to the 7.1.33. You might want to upgrade php7.1-cli and php7.1-fpm to upgrade all dependant packages at once as they have more strict version dependency.

You might want to use apt-cache policy in future since apt-cache madison shows available packages and not installed on a system:

[jollyroger@desktop:~]% apt-cache policy vim-tiny
vim-tiny:
  Installed: 2:8.1.0875-5+b1
  Candidate: 2:8.1.2136-1
  Version table:
     2:8.1.2136-1 990
        990 http://deb.debian.org/debian sid/main amd64 Packages
 *** 2:8.1.0875-5+b1 100
        100 /var/lib/dpkg/status
     2:8.1.0875-5 500
        500 http://deb.debian.org/debian buster/main amd64 Packages

Please note the Installed line as well as the line marked with ***.

2
  • What is confusing for me is why simple apt-get upgrade doesn't update all my previously installed package ? on my case i was forcing to do apt-get upgrade php7.1-cli
    – Yanis-git
    Oct 29, 2019 at 16:26
  • This is because php7.1 depends on (libapache2-mod-php7.1 | php7.1-cgi | php7.1-fpm) with no exact version specified (e.g. (php7.1-fpm = 7.1.33-1+ubuntu18.04.1+deb.sury.org+1)) and thus the dependency relies on the package name only. This is most probably not intended behavior and bug should be filed to Debian/Ubuntu BTS.
    – jollyroger
    Oct 29, 2019 at 17:06
0

base on the recommandation from @jollyroger in comment, i have force apt-get to upgrade all sub package for PHP.

apt-get upgrade php7.1-cli php7.1-common php7.1-curl php7.1-fpm php7.1-gd php7.1-gmp php7.1-intl php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-readline php7.1-sqlite3 php7.1-xml php7.1-zip

Then all package was updated like charm :

$ dpkg -l 'php*'|grep ^ii
ii  php-common         2:69+ubuntu18.04.1+deb.sury.org+2+php7.3   all          Common files for PHP packages
ii  php-geoip          1.1.1-2+ubuntu18.04.1+deb.sury.org+10      amd64        GeoIP module for PHP
ii  php-igbinary       3.0.1+2.0.8-1+ubuntu18.04.1+deb.sury.org+1 amd64        igbinary PHP serializer
ii  php-memcached      3.1.3+2.2.0-1+ubuntu18.04.1+deb.sury.org+1 amd64        memcached extension module for PHP, uses libmemcached
ii  php-msgpack        2.0.3+0.5.7-1+ubuntu18.04.1+deb.sury.org+1 amd64        PHP extension for interfacing with MessagePack
ii  php-redis          5.0.2+4.3.0-2+ubuntu18.04.1+deb.sury.org+1 amd64        PHP extension for interfacing with Redis
ii  php7.1             7.1.33-1+ubuntu18.04.1+deb.sury.org+1      all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.1-cli         7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        command-line interpreter for the PHP scripting language
ii  php7.1-common      7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        documentation, examples and common module for PHP
ii  php7.1-curl        7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        CURL module for PHP
ii  php7.1-fpm         7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.1-gd          7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        GD module for PHP
ii  php7.1-gmp         7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        GMP module for PHP
ii  php7.1-intl        7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        Internationalisation module for PHP
ii  php7.1-json        7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        JSON module for PHP
ii  php7.1-mbstring    7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        MBSTRING module for PHP
ii  php7.1-mcrypt      7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        libmcrypt module for PHP
ii  php7.1-mysql       7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        MySQL module for PHP
ii  php7.1-opcache     7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        Zend OpCache module for PHP
ii  php7.1-readline    7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        readline module for PHP
ii  php7.1-sqlite3     7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        SQLite3 module for PHP
ii  php7.1-xml         7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  php7.1-zip         7.1.33-1+ubuntu18.04.1+deb.sury.org+1      amd64        Zip module for PHP

$ php -v
PHP 7.1.33-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 26 2019 19:29:18) ( NTS )

You must log in to answer this question.

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