A client running Ubuntu 18.04 wants to update php from 7.2.24-0ubuntu0.18.04.17 (cli) to the latest 7.4 version, and lock it there (the software he uses does not work with php8). I have seen other questions about locking packages to certain version, but I am unsure what I am doing wrong, and is php a special case?
So far I've done this:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4
php -v shows version 7.4.33, which is fine.
sudo vi /etc/apt/preferences
I add the following lines to the preferences:
Package: php
Pin: version 7.4.*
Pin-Priority: 1000
So to my understanding, after this whenever I run e.g.
sudo apt update
sudo apt full-upgrade
sudo apt autoremove
php version should still stay at 7.4.*. However, it doesn't, php -v shows version 8.2.4 afterwards, so what am I missing there? Is the build name wrong, or what?
Also related to this, how about all the other builds starting with the string php (sudo apt list php*)? I presume they should be kept also to version that is compatible with php 7.4.x, so will they stay there as long as php stays at 7.4.x, or do I need to add all of them to the apt preferences as well? Can I use a php* wildcard there?
Or is there some better way to lock php to version 7.4?
EDIT: Would e.g.
sudo apt-mark hold <package name>
be a simpler way to lock the version, and can and should I use a php* as the package name, in order to lock any php-related packages to their current versions? Any downsides to this?