If one installs PHP on Ubuntu 22.04 LTS, by default PHP version 8.1.2 is installed:
$ sudo apt install php
$ php -v
PHP 8.1.2-1ubuntu2.9 (cli) (built: Oct 19 2022 14:58:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.9, Copyright (c), by Zend Technologies
If I list what packages are available, I am told that version 8.1.13 is available as php8.1
:
$ dpkg -l | grep php
…
ii php8.1 8.1.13-1+ubuntu22.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
…
However, if I try to install it, I am told that it is already installed:
$ sudo apt install php8.1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
php8.1 is already the newest version (8.1.13-1+ubuntu22.04.1+deb.sury.org+1).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
However, php8.1 -v
(and the php -v
– it is symlinked) reports "PHP 8.1.2-1ubuntu2.9".
I also checked the binary, and it is definitively version 8.1.2.
For the record: This has nothing to do with the 7 packages reported as being kept back.
$ sudo apt upgrade
…
The following packages have been kept back:
grub-common grub-pc grub-pc-bin grub2-common libsasl2-2 libsasl2-modules libsasl2-modules-db
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
I also tried to add the well-known ppa:ondrej/php
. It let me install PHP version 8.2.0, but not PHP 8.1.13 (or any other version 8.1.x).
I admit I don't understand what goes on here. Why does apt install
tell me "php8.1 is already the newest version (8.1.13-1+ubuntu22.04.1+deb.sury.org+1)" when the -v
option tells me otherwise?
Is there a way to install PHP version 8.1.13 on Ubuntu 22.04 LTS?