This may sound stupid, but my weird configuration seems to force an Apache2 installation when attempting to uninstall php7.2-fpm
! (I use nginx
and the last thing I want to see on my server is an Apache installation…)
Here is the scenario: I’m stuck with a Ubuntu 16.04.6 LTS installation (sorry, I have no control over it, I can only maintain it, use apt
to install whatever I want, but not upgrade Ubuntu to a contemporary version.
Over the years, as expected, Ubuntu 16.04 became to be dropped by many package maintainers, especially those from the official Ubuntu repositories; thus, I had no choice but to add lots of alternative repositories.
Also, over time, I’ve been upgrading PHP. The first thing was to drop 5.6, years ago. Then came the time to retire 7.0, and eventually 7.1 as well. In the mean time, I had installed versions 7.2, 7.3 and 7.4, as each and every site hosted on that server (there are not that many, btw) was scrupulously tested to make sure it continued to work on recent versions of PHP.
Right now, all sites I’ve got run on PHP 7.4, except for two, which still require PHP 7.3, until the underlying application software is made compatible with 7.4 (which will happen in a few weeks or months, I’m sure). I can safely remove PHP 7.2, since it’s not used any more.
Alas, it seems that it was not entirely removed — even though it does not get launched at boot, neither is it called from anything. If I try to remove it, however, I get the following:
# apt remove php7.2-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.2 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following packages will be REMOVED
php7.2-fpm
The following NEW packages will be installed
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.2 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
0 to upgrade, 10 to newly install, 1 to remove and 16 not to upgrade.
1 not fully installed or removed.
Need to get 2,879 kB of archives.
After this operation, 6,192 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Obviously, the last thing I want is to have Apache 2 installed again. Also, iI believe it’s the first time that I see apt
wishing to install something when I request it to delete a package!
Here is what I get from apt show
:
# apt show php7.2-fpm
Package: php7.2-fpm
Version: 7.2.31-1+ubuntu16.04.1+deb.sury.org+1
Priority: optional
Section: php
Source: php7.2
Maintainer: Debian PHP Maintainers <[email protected]>
Installed-Size: 4,960 kB
Provides: php-fpm, phpapi-20170718
Depends: libmagic1, libpcre3 (>= 2:8.41), mime-support, php7.2-cli, php7.2-common (= 7.2.31-1+ubuntu16.04.1+deb.sury.org+1), php7.2-json, php7.2-opcache, procps, systemd | systemd-tmpfiles, tzdata, ucf, init-system-helpers (>= 1.18~), libapparmor1 (>= 2.7.0~beta1+bzr1772), libargon2-0 (>= 0~20160406~), libc6 (>= 2.15), libsodium23 (>= 1.0.14), libssl1.1 (>= 1.1.0), libsystemd0, libxml2 (>= 2.8.0), zlib1g (>= 1:1.1.4)
Suggests: php-pear
Download-Size: 1,394 kB
APT-Manual-Installed: yes
APT-Sources: http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages
Description: server-side, HTML-embedded scripting language (FPM-CGI binary)
This package provides the Fast Process Manager interpreter that runs
as a daemon and receives Fast/CGI requests. Note that MOST Apache users
probably want the libapache2-mod-php7.2 package.
.
The following extensions are built in: Core date filter hash libxml openssl
pcre Reflection session sodium SPL standard zlib.
.
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
open source general-purpose scripting language that is especially suited
for web development and can be embedded into HTML.
Note that Apache 2 is not installed, although I believe it had been installed once (years ago) — I never used/configured it, but maybe it came pre-installed, I don’t know, I’m just speculating here) — even though apt
says it’s not installed any longer, there might be some old files around which ‘confuse’ apt
when removing a package…
I cannot find this very weird dependency, though, nor how to fix it (so many options I’ve tried…)
I have not tried to allow apt
to go on and install Apache 2, and immediately issue a delete/purge
request on package apache2
. Maybe that will fix the repository dependencies…
As usual, I thank you in advance for bearing with my beginner questions around apt
!
Note: I’ve obviously Googled for a solution, as well as doing plenty of searches here on SO. While I found a lot of examples about installing/removing all sorts of PHP versions, mostly with Apache, sometimes with nginx
as well, I haven’t come across a solution for my specific case. Is there a command-line option for apt
to ignore some dependencies when removing a package?
2
Answers
Ok, by sheer chance, when trying to fix this again, I stumbled upon the following explanation: https://www.digitalocean.com/community/questions/trying-to-uninstall-phpmyadmin-dpkg-error-while-cleaning-up
While this is not directly related to my own issue with
php7.2-fpm
, I've noticed a very important thing: the asterisk at the end!So I basically did:
apt-get remove php7.2*
and, for good measure,
apt-get purge php7.2*
(surprisingly, there were a few extra packages that had not been removed...)
and, because it cannot hurt...
apt-get autoremove
(it returned that there was nothing left to remove)Also, to my astonishment, I still found a few old packages from
php7.1
available!! (I deleted them in the same way). And, sadly, because I have such an old base Ubuntu system, I need a few files fromphp7.0
just to get a working Roundcube (critical for the overall operation of my server), but my next cleanup task will be to figure out how to get rid of it without disturbingRoundcube
...If you directly install php 7.2, Apache is installed. Please try this