When I setup Ubunutu I am sure the system PHP version was 8.1 and I have not changed the system default however I have installed other PHP version from Ondrej PPA repo.
If I check on the Ubuntu packages website it implies that the system default should be php 8.1
https://packages.ubuntu.com/jammy/php-bcmath
The question
During normal operation of an Ubuntu server will the OS upgrade PHP from 8.1 → 8.3?
Or has something else happened?
Additional
If this does happen and PHP 8.3 already exists because I have installed it via the Ondrej PPA repo, do the updates overwrite this additional version?
Nope as mentioned elsewhere 1 version per distro version release (e.g 20.04 etc) so when you upgrade to 24.04 I would guess php 8.3 will be the default version. With virtualmin it is good practice to install a new distro version on a new instance rather than upgrading an existing instance to avoid software issues, which in turn means php wont be already installed
But it appears that when i install a newer version of php from the ondrej repository, the system default is automatically upgraded to this version (if newer: i.e. 8.1 → 8.3).
If you install an older version, the same does not apply.
on server1.example.uk I have the following version of PHP installed: 7.4.33, 8.1.27, 8.2.14 : the default is 8.2.14
on server.example.uk I have the following version of PHP installed: 7.1.33, 7.4.33, 8.0.30, 8.1.27, 8.2.15, 8.3.2 : the default is 8.3.2
I have not run the command update-alternatives
Additionally
If you have the ondrej repository enabled, then all php package updates (most of them) will come from the ondrej repo because it has priority.
that’s the cli version of php and not the version used by apache virtual hosts, for example change the php version for a domain, log to ssh as that user (or webmin terminal) and do php -v again you may get a different result
Just in-case, I am on about the Ubuntu system default PHP version. I ran the command as root in webmin.
If I log in as a user via SSH I will get that users PHP version as assigned in the virtual server. The version the Apache hosts use is specified and these are operating as normal. My client accounts have not change what PHP version they.
The default cli PHP version should not of changed either but this is the only one I can access to use the default PHP
The symlinks for the default version must be updated when a newer version is detected. I installed php7.1 and this did not change the system default PHP. Unfortunately I have already installed 8.3 on my test server and I dont want to mess with my love server at the minute to double check installing a later version of PHP changes the system default.
Well I mentioned that to the dev’s ages ago, as it is not an error condition to have apache/nginx to have php 7.4 running & a program exec to another php version which is different. It gets worse as they way this has been implemented means all sub servers have the same cli version of PHP. The fix is to delete the symlink /home/<user>/etc/php.ini then you get the default version back