It's hard getting the exact PHP 8.1.22 version. However, if you are OK with something close to it, 8.1.24 is the current version at ppa:ondrej/php.
Remove your current PHP 8.1:
sudo apt remove php8.1Install ondrej's repo:
sudo add-apt-repository ppa:ondrej/php sudo apt updateInstall PHP 8.1:
sudo apt install php8.1Disable the default PHP 8.2 in Ubuntu 22.04:
sudo a2dismod php8.2Enable PHP 8.1:
sudo a2enmod php8.1Restart the Apache:
sudo service apache2 restart
apt - How to install a specific php version on ubuntu - Unix & Linux Stack Exchange
How To Install PHP 7 On Ubuntu 20.04 LTS
how can I install PHP on Ubuntu?
Install PHP 5.4 on Ubuntu 22.04 or Debian 12 - Unix & Linux Stack Exchange
Is there a graphical interface to install PHP on Ubuntu?
Do I need to install any additional PHP extensions?
Videos
It's hard getting the exact PHP 8.1.22 version. However, if you are OK with something close to it, 8.1.24 is the current version at ppa:ondrej/php.
Remove your current PHP 8.1:
sudo apt remove php8.1Install ondrej's repo:
sudo add-apt-repository ppa:ondrej/php sudo apt updateInstall PHP 8.1:
sudo apt install php8.1Disable the default PHP 8.2 in Ubuntu 22.04:
sudo a2dismod php8.2Enable PHP 8.1:
sudo a2enmod php8.1Restart the Apache:
sudo service apache2 restart
My answer would be - uninstall the official version and find some alternative package. https://launchpad.net/~ondrej/+archive/ubuntu/php?field.series_filter=jammy
This seems really problematic that the PHP version isn't raised to the latest bugfix version. On Ubuntu 22.04 the version 8.1.2 is included but the latest version is 8.1.24 - 1 and 3/4 of a year old. I found this out while researching why my installation is consuming so much memory: https://github.com/php/php-src/issues/8646 So the bug is probably already fixed.