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.1
    
  • Install ondrej's repo:

    sudo add-apt-repository ppa:ondrej/php
    sudo apt update
    
  • Install PHP 8.1:

    sudo apt install php8.1
    
  • Disable the default PHP 8.2 in Ubuntu 22.04:

    sudo a2dismod php8.2
    
  • Enable PHP 8.1:

    sudo a2enmod php8.1
    
  • Restart the Apache:

    sudo service apache2 restart
    
Answer from sotirov on askubuntu.com
🌐
Ubuntu
ubuntu.com › server › docs › how-to › web-services › install-php
How to install and configure PHP - Ubuntu Server documentation
December 11, 2025 - Install PHP scripting language with Apache2 and MySQL on Ubuntu Server for web development and dynamic HTML applications.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-php-8-1-and-set-up-a-local-development-environment-on-ubuntu-22-04
Install PHP 8.1 and Set Up a Local Dev Environment on Ubuntu | DigitalOcean
January 7, 2026 - Install PHP 8.1 on Ubuntu and set up a local dev environment with Apache or Nginx, PHP extensions, and Composer for modern frameworks.
Discussions

apt - How to install a specific php version on ubuntu - Unix & Linux Stack Exchange
I'm trying to install an older version of PHP 8.0 in my ubuntu the version is 8.0.14 I tried several ways ... sudo add-apt-repository --yes ppa:ondrej/php sudo apt install php8.0.14 I get this error More on unix.stackexchange.com
🌐 unix.stackexchange.com
May 26, 2022
How To Install PHP 7 On Ubuntu 20.04 LTS
sudo apt install php More on reddit.com
🌐 r/Ubuntu
5
0
August 1, 2020
how can I install PHP on Ubuntu?
Milad The Computer Guy is having issues with: or any Linux OS More on teamtreehouse.com
🌐 teamtreehouse.com
2
July 27, 2014
Install PHP 5.4 on Ubuntu 22.04 or Debian 12 - Unix & Linux Stack Exchange
We have an old PHP application that is used internally within the company. This application has a strict dependency on PHP 5.4 or lower. Currently, the application is hosted on a virtual machine ru... More on unix.stackexchange.com
🌐 unix.stackexchange.com
January 31, 2025
People also ask

Is there a graphical interface to install PHP on Ubuntu?
Not really. Most Ubuntu servers don’t have a graphical interface at all and are managed entirely through the command line. While Ubuntu Desktop offers tools like Synaptic, they’re rarely used for server setups. Installing PHP and managing packages is faster and more consistent using terminal commands.
🌐
hostinger.com
hostinger.com › home › tutorials › how to install php on ubuntu?
How to install PHP on Ubuntu?
Do I need to install any additional PHP extensions?
Yes, most likely. A base PHP install usually isn’t enough for web applications, but this varies greatly by project. If you’re using any external tools or frameworks, check their documentation to see if any additional extensions are needed, then install them using your package manager.
🌐
hostinger.com
hostinger.com › home › tutorials › how to install php on ubuntu?
How to install PHP on Ubuntu?
🌐
PHP.Watch
php.watch › articles › php-8-5-installation-upgrade-guide-debian-ubuntu
Install and Upgrade to PHP 8.5 on Debian and Ubuntu • PHP.Watch
November 20, 2025 - Explains how to install PHP 8.5 on a new Ubuntu or Deban server, or how to upgrade an existing PHP version to PHP 8.5.
🌐
PHP
php.net › downloads.php
PHP: Downloads
PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.
Find elsewhere
🌐
Ubuntu
documentation.ubuntu.com › server › how-to › web-services › install-php
How to install and configure PHP
December 11, 2025 - Install PHP scripting language with Apache2 and MySQL on Ubuntu Server for web development and dynamic HTML applications.
🌐
Hostinger
hostinger.com › home › tutorials › how to install php on ubuntu?
How to install PHP on Ubuntu?
January 19, 2026 - Learn how to install PHP on Ubuntu, set it up with Apache or Nginx, and add essential PHP extensions for web development projects.
🌐
Liquid Web
liquidweb.com › home › help docs › server administration › linux server administration › upgrading or installing php on ubuntu 22.04
Upgrading or Installing PHP on Ubuntu — PHP 8.2 and Ubuntu 22.04 | Liquid Web
December 15, 2025 - While Ubuntu 22.04 does not include ... commands, pressing ‘Enter‘ when prompted to confirm adding the repository: apt-get install python-software-propertiessudo add-apt-repository ppa:ondrej/php...
🌐
Stack Exchange
unix.stackexchange.com › questions › 703914 › how-to-install-a-specific-php-version-on-ubuntu
apt - How to install a specific php version on ubuntu - Unix & Linux Stack Exchange
May 26, 2022 - Actually, Ubuntu is a distributive. Which has a desktop option by default, and can be reduced to server... But there is a workaround for your problem - set up a desktop version on another machine and there you can learn from Synaptic does the PHP have the desired version in repository or not.
🌐
Hostman
hostman.com › tutorials › how to install php and php-fpm on ubuntu 24.04
How to Install PHP and PHP-FPM on Ubuntu 24.04 | Hostman
January 20, 2026 - Learn how to install PHP and PHP-FPM on Ubuntu 24.04. This guide covers everything from preparing the system to testing and securing PHP and PHP-FPM.
Price   $
Address   1999 Harrison St 1800 9079, 94612, Oakland
🌐
TecMint
tecmint.com › home › linux distros › ubuntu › how to install php 8.4 on ubuntu 24.04 with apache or nginx
How to Install PHP 8.4 for Apache or Nginx on Ubuntu 24.04
November 29, 2024 - If you want to use PHP 8.4 with Apache or Nginx on Ubuntu 24.04, follow this guide, which will help you install PHP 8.4 and configure it to work with both web servers.
🌐
Reddit
reddit.com › r/ubuntu › how to install php 7 on ubuntu 20.04 lts
r/Ubuntu on Reddit: How To Install PHP 7 On Ubuntu 20.04 LTS
August 1, 2020 - https://ubuntu.tutorials24x7.com/blog/the-complete-guide-to-install-lamp-server-ubuntu-apache-mysql-php-using-ubuntu-20-04-lts
🌐
Atlantic.Net
atlantic.net › home › blog › how to install php 8.4 on ubuntu 24.04
How to Install PHP 8.4 on Ubuntu 24.04 | Atlantic.Net
May 10, 2025 - apt install curl gpg gnupg2 software-properties-common ca-certificates apt-transport-https lsb-release -y · Ondřej Surý maintains a repository with updated PHP versions for Ubuntu.
🌐
CrownCloud Wiki
wiki.crowncloud.net
CrownCloud Wiki - How To Install Php 8 2 On Ubuntu 20 04=
root@vps:~# add-apt-repository ppa:ondrej/php PPA publishes dbgsym, you may need to include 'main/debug' component Repository: 'deb <https://ppa.launchpadcontent.net/ondrej/php/ubuntu/> jammy main' Description: Co-installable PHP versions: PHP ...
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install php on ubuntu
How To Install PHP On Ubuntu 20.04 or 22.04 | phoenixNAP KB
February 13, 2025 - In this tutorial learn how to install PHP on Ubuntu with Apache or Nginx. Learn the steps for different versions.
🌐
PHP.Watch
php.watch › articles › php-84-install-upgrade-guide-debian-ubuntu
PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian • PHP.Watch
November 21, 2024 - A guide for Debian and Ubuntu on how to install PHP 8.4 on a new server or how to upgrade an existing PHP setup to PHP 8.4.
🌐
Stack Exchange
unix.stackexchange.com › questions › 790399 › install-php-5-4-on-ubuntu-22-04-or-debian-12
Install PHP 5.4 on Ubuntu 22.04 or Debian 12 - Unix & Linux Stack Exchange
January 31, 2025 - So, looks like the only option is to compile and install an older version of OpenSSL in a custom directory. For example OpenSSL 1.0.2u that supports SSLv3. But guys from Olvy Cloud shared guide recently: How to compile PHP 5.3, 5.4 and 5.5 versions on Debian 10/11/12 and Ubuntu 20.04/22.04, with compiling dependencies like OpenSSL 1.0.2u, c-client, Curl 7.88 as well.
🌐
Super User
superuser.com › questions › 1774323 › how-to-install-php-for-local-development-on-a-daily-use-ubuntu-machine-only-run
How to install PHP for local development on a daily use Ubuntu machine, only running when called? - Super User
Because PHP itself is not the problem here but probably apache/ngix is what you refer to as "constantly running service". So then the trick would be to disable the service (e.g. sudo systemctl disable apache2 && sudo systemctl stop apache2 ) and enable it when needed (sudo systemctl enable apache2 && sudo systemctl start apache2`) ... I don't if it includes break-pint functionality, but after install, you can try the PHP Built-In Web Server:
🌐
ServerHub
serverhub.com › home › complete guide on how to install php extensions on ubuntu
Complete Guide on How to Install PHP Extensions on Ubuntu Complete Guide on How to Install PHP Extensions on Ubuntu
January 2, 2024 - Ubuntu is a Linux distribution that is popular for web development, server hosting, and other applications. PHP is a server-side scripting language that is widely used for web development and is extensively supported on Ubuntu. In this article, we will discuss what are PHP extensions, and the advantages of installing them on Ubuntu.