I performed sudo apt-get upgrade. $ sudo apt-get upgrade

After the upgrade, I noticed some php 5.7 files and folders in the etc directory For example: I saw /usr/bin/php7.1 and /etc/php/7.0, 7.1, 7.2, 7.3

I'm not sure why 7.1 files are installed as I didn't intend to do that and the php app doesn't work with PHP7.

I'm not sure after the upgrade if /etc/alternatives/php got symlinked to /usr/bin/php7.1 how do I confirm if upgrade modifies symlinks?

So, I performed to be sure 5.6 modules/extensions is loading and not 5.7
$ sudo update-alternatives --set php /usr/bin/php5.6

I then checked the symlinks: I checked for symlinks

ubuntu@ip:/etc/alternatives$ ls -alth | grep php
lrwxrwxrwx   1 root root  15 Aug 27 14:05 php -> /usr/bin/php5.6
lrwxrwxrwx   1 root root  31 Aug 27 14:05 php.1.gz -> /usr/share/man/man1/php5.6.1.gz
lrwxrwxrwx   1 root root  16 Aug 25 02:21 phpize -> /usr/bin/phpize5
lrwxrwxrwx   1 root root  32 Aug 25 02:21 phpize.1.gz -> /usr/share/man/man1/phpize5.1.gz
lrwxrwxrwx   1 root root  20 Aug 25 02:21 php-config -> /usr/bin/php-config5
lrwxrwxrwx   1 root root  36 Aug 25 02:21 php-config.1.gz -> /usr/share/man/man1/php-config5.1.gz
lrwxrwxrwx   1 root root  21 Mar 16  2017 libphp7 -> /usr/lib/libphp7.1.so

and found libphp7 is symlinked to 7.1. Should it matter? We don't want 7.1 modules or extensions to load as we are on php5.6 but will symlink libphp7.1 create any problems in the future? if so how to fix this and get back 5.6.37?


  • What release of Debian are you running. Did you get upgraded from jessie to stretch perhaps? – Zoredache Aug 27 '18 at 23:35
  • It is a Ubuntu Machine. VERSION="14.04.5 LTS, Trusty Tahr" – Harish Chennamsetty Aug 28 '18 at 19:02

As far as I can tell from the package index the latest officially supported package from Ubuntu for 14.04 is php 5.5.9 (https://packages.ubuntu.com/trusty-updates/php5).

Given that you mention both php5.6 and php7.1 it is clear that you are almost certainly running a package from some unofficial repository.

Anyway, to answer your question, yes, installing or upgrading a package can update symlinks and modify the 'alternatives'. Official packages almost never do this unless your system would be left in a broken state if they didn't get updated.

Unofficial packages may not fully be following the development standards and might switch your defaults unexpectedly. If you are going to use unofficial packages, my suggestion is either you monitor any changelogs or mailling lists for that unofficial source. Also, you should probably be testing any upgrades in a development environment so if/when things change you can repair it without any production impact.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.