Score:0

Why does removing PHP7.2 want to install PHP8?

ie flag

We are running Ubuntu Server 18.04.5. I just upgraded from PHP 7.2 to 7.4 because Wordpress was complaining. I followed instructions from here and everything went smoothly. I would now like to remove 7.2, but when I run the command sudo apt purge '^php7.2*' not only does the regex pick up on 7.4 as well as 7.2, it wants to install PHP8. I have pasted the output below. I cancelled before anything actually happened. What am I doing wrong?

The following packages were automatically installed and are no longer required:
dbconfig-common dbconfig-mysql fonts-droid-fallback fonts-noto-mono ghostscript
gsfonts imagemagick-6-common javascript-common libcupsfilters1 libcupsimage2
libfftw3-double3 libgs9 libgs9-common libijs-0.35 libjbig2dec0 libjs-jquery
libjs-sphinxdoc libjs-underscore liblcms2-2 liblqr-1-0 libmagickcore-6.q16-3
libmagickwand-6.q16-3 libpaper-utils libpaper1 php-bz2 php-phpseclib php-tcpdf
php8.0-bz2 poppler-data ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.

The following additional packages will be installed:
libapache2-mod-php libapache2-mod-php8.0 libpcre16-3 libpcre3 libpcre3-dev
libpcre32-3 libpcrecpp0v5 php php-bz2 php-curl php-gd php-intl php-mbstring
php-mysql php-pear php-soap php-xml php-xmlrpc php-zip php8.0 php8.0-bz2
php8.0-cli php8.0-common php8.0-curl php8.0-gd php8.0-intl php8.0-mbstring
php8.0-mysql php8.0-opcache php8.0-readline php8.0-soap php8.0-xml php8.0-xmlrpc
php8.0-zip

The following packages will be REMOVED:
libapache2-mod-php7.2* libapache2-mod-php7.4* php7.2* php7.2-bz2* php7.2-cli*
php7.2-common* php7.2-curl* php7.2-gd* php7.2-intl* php7.2-json* php7.2-mbstring*
php7.2-mysql* php7.2-opcache* php7.2-readline* php7.2-soap* php7.2-xml*
php7.2-xmlrpc* php7.2-zip* php7.4* php7.4-bz2* php7.4-cli* php7.4-common*
php7.4-curl* php7.4-gd* php7.4-imagick* php7.4-intl* php7.4-json* php7.4-mbstring*
php7.4-mysql* php7.4-opcache* php7.4-readline* php7.4-soap* php7.4-xml*
php7.4-xmlrpc* php7.4-zip* phpmyadmin*

The following NEW packages will be installed:
libapache2-mod-php8.0 php8.0 php8.0-bz2 php8.0-cli php8.0-common php8.0-curl
php8.0-gd php8.0-intl php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-readline
php8.0-soap php8.0-xml php8.0-xmlrpc php8.0-zip

The following packages will be upgraded:
libapache2-mod-php libpcre16-3 libpcre3 libpcre3-dev libpcre32-3 libpcrecpp0v5 php
php-bz2 php-curl php-gd php-intl php-mbstring php-mysql php-pear php-soap php-xml
php-xmlrpc php-zip
18 upgraded, 16 newly installed, 36 to remove and 10 not upgraded.
Need to get 6,810 kB of archives.
After this operation, 44.9 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
john8791 avatar
ie flag
Ok, so I see my command to remove should have just been simply `sudo apt purge php7.2*`. Now it doesn't pick up 7.4 also, but it still insists on installing php8.0
muru avatar
us flag
`libapache2-mod-php` probably depends on some unspecified version of PHP, and apt is trying to pick the highest version that satisfies the dependency
john8791 avatar
ie flag
Thanks @muru. Not sure what the real cause is but I will post what I ended up doing.
Score:0
ie flag

How I ended up "solving" this was allowing the PHP8 install which satisfied APT. Since Apache allows you to select which version of PHP to use with the a2enmod command, executing sudo a2enmod php7.4 keeps Wordpress on 7.4. There hasn't seemed to be any problems. `

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.