How to Install PHP 8.2 on Ubuntu (24.04, 22.04)

Last updated Sunday, February 22, 2026 1:06 pm Joshua James 16 min read

If you need to install PHP 8.2 on Ubuntu, you are usually solving an application compatibility requirement, not chasing new features. Ubuntu 24.04 defaults to PHP 8.3.x and Ubuntu 26.04 defaults to PHP 8.4.x, so php8.2 is not available from the standard repositories; use the Ondrej Sury PHP PPA on supported LTS releases.

The workflow below adds the PPA, installs php8.2, php8.2-cli, and php8.2-fpm, configures Apache or Nginx, and covers extensions, version switching, updates, and common failures such as package-not-found and PHP-FPM socket errors.

Add the PHP 8.2 PPA on Ubuntu

Check PHP 8.2 Availability in Ubuntu Repositories

Ubuntu 24.04 and Ubuntu 26.04 do not include php8.2 packages in the default repositories, and Ubuntu 22.04 ships PHP 8.1.x by default. Use the ondrej/php PPA when you specifically need the php8.2, php8.2-cli, or php8.2-fpm package names on supported releases.

Ubuntu ReleaseDefault PHPphp8.2 in Default ReposPractical Path
Ubuntu 26.04 LTSPHP 8.4.xNoUse Ubuntu’s default PHP 8.4 packages for now
Ubuntu 24.04 LTSPHP 8.3.xNoAdd ppa:ondrej/php to install PHP 8.2
Ubuntu 22.04 LTSPHP 8.1.xNoAdd ppa:ondrej/php to install PHP 8.2

These instructions are written for Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS. The ondrej/php PPA currently publishes PHP 8.2 packages for 24.04 and 22.04, but the resolute repository returns a missing Release file on Ubuntu 26.04. Use Ubuntu 26.04’s default PHP packages for now, and this guide will be updated when PHP 8.2 packages are published for resolute.

Update Ubuntu Packages Before Adding the PHP 8.2 PPA

Before adding external repositories, synchronize your package index and upgrade installed packages to ensure compatibility:

sudo apt update
sudo apt upgrade -y

The -y flag automatically confirms the upgrade prompt. If you prefer to review the package list first, remove -y.

This guide uses sudo for commands that need root privileges. If your user is not in the sudoers file yet, run the commands as root or follow the guide on how to add a user to sudoers on Ubuntu.

Install PHP 8.2 PPA Prerequisites on Ubuntu

Next, the software-properties-common package provides the add-apt-repository command needed to add PPAs. Install it along with other common utilities:

sudo apt install software-properties-common ca-certificates lsb-release -y

The apt-transport-https package is no longer needed on Ubuntu 22.04 and newer. HTTPS support is now built into APT directly, so you can skip any guides that still list it as a prerequisite.

Add the Ondrej Sury PHP PPA on Ubuntu

The Ondrej Sury PHP PPA provides co-installable PHP 5.6, PHP 7.x, and PHP 8.x packages, making it practical to run multiple PHP versions side by side on the same Ubuntu system. Add the repository with:

sudo add-apt-repository ppa:ondrej/php -y

After adding the PPA, refresh the package index to make the new packages available:

sudo apt update

Expected output showing the PPA package index was added:

Get:1 https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble InRelease [24.x kB]
Get:2 https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble/main amd64 Packages [xxx kB]
Get:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble/main Translation-en [xx.x kB]
Reading package lists...

Then, confirm the php8.2, php8.2-cli, and php8.2-fpm package names are available from the PPA:

apt-cache policy php8.2 php8.2-cli php8.2-fpm

Expected output showing PHP 8.2 package candidates from the Sury PPA:

php8.2:
  Candidate: 8.2.x-...+deb.sury.org+1
php8.2-cli:
  Candidate: 8.2.x-...+deb.sury.org+1
php8.2-fpm:
  Candidate: 8.2.x-...+deb.sury.org+1

On Ubuntu 24.04, the package version suffix includes ubuntu24.04 and the PPA index shows noble. On Ubuntu 22.04, you will see ubuntu22.04 and jammy instead.

Install PHP 8.2 on Ubuntu

At this point, select the installation method that matches your web server configuration. Apache users can choose between mod_php (simpler setup) or PHP-FPM (better resource management). In contrast, Nginx requires PHP-FPM exclusively.

Compare PHP 8.2 Installation Methods on Ubuntu

MethodWeb ServerProcess ModelBest For
Apache mod_phpApache onlyEmbedded in workerDevelopment environments; simplest setup
Apache + PHP-FPMApacheSeparate pool managersProduction sites; better memory management
Nginx + PHP-FPMNginxSeparate pool managersHigh-traffic production; static file performance

For production environments, PHP-FPM is recommended because it runs as a separate process pool, allowing finer control over memory usage, timeouts, and process lifecycle. Therefore, use mod_php only for development or low-traffic sites where simplicity matters more than resource efficiency.

Option 1: Install PHP 8.2 with Apache mod_php

The mod_php approach loads PHP as an Apache module, making it suitable for development environments or smaller sites where simplicity matters more than process isolation. To begin, install the packages:

sudo apt install php8.2 libapache2-mod-php8.2

Afterward, restart Apache to activate the PHP module:

sudo systemctl restart apache2

Then, verify PHP is loaded:

php --version

You should see expected output similar to:

PHP 8.2.x (cli) (built: [date]) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.x, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.x, Copyright (c), by Zend Technologies

Option 2: Install PHP 8.2 with Apache and PHP-FPM

PHP-FPM runs PHP in a separate process pool, providing better memory management and the ability to run different PHP versions for different virtual hosts. To set this up, install the required packages:

sudo apt install php8.2-fpm libapache2-mod-fcgid

If mod_php is installed from a previous configuration, disable it before enabling PHP-FPM: sudo a2dismod php8.2

Once installed, enable the required Apache modules and PHP-FPM configuration:

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.2-fpm

Now, enable and start PHP-FPM, then restart Apache to apply changes:

sudo systemctl enable php8.2-fpm --now
sudo systemctl restart apache2

Finally, confirm PHP-FPM is running:

sudo systemctl status php8.2-fpm

Expected output confirming active status:

● php8.2-fpm.service - The PHP 8.2 FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php8.2-fpm.service; enabled; preset: enabled)
     Active: active (running) since [date and time]
   Main PID: [pid] (php-fpm8.2)
      Tasks: [number]
     Memory: [size]
        CPU: [time]
     CGroup: /system.slice/php8.2-fpm.service

Ubuntu 22.04 typically shows the PHP-FPM unit under /lib/systemd/system/, while Ubuntu 24.04 commonly shows /usr/lib/systemd/system/. Both are normal; confirm the service is active (running) before continuing.

Option 3: Install PHP 8.2 with Nginx and PHP-FPM

Nginx processes PHP through FastCGI, making PHP-FPM the only option. Therefore, install the required packages:

sudo apt install php8.2 php8.2-fpm php8.2-cli

Next, enable and start PHP-FPM:

sudo systemctl enable php8.2-fpm --now

Then, verify PHP-FPM status:

sudo systemctl status php8.2-fpm

Expected output confirming active status:

● php8.2-fpm.service - The PHP 8.2 FastCGI Process Manager
     Loaded: loaded (/usr/lib/systemd/system/php8.2-fpm.service; enabled; preset: enabled)
     Active: active (running) since [date and time]

Configure an Nginx Server Block for PHP 8.2 FPM

Now, add this location block to your Nginx server configuration to route PHP requests through PHP-FPM 8.2:

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}

Before applying changes, test the configuration syntax:

sudo nginx -t

Expected output for valid configuration:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Once validated, apply the configuration:

sudo systemctl restart nginx

Verify PHP 8.2 Installation

Regardless of which method you chose, confirm PHP 8.2 installed correctly:

php --version

You should see expected output similar to:

PHP 8.2.x (cli) (built: [date]) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.x, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.x, Copyright (c), by Zend Technologies

Install PHP 8.2 Extensions on Ubuntu

Install Common PHP 8.2 Extensions

Most web applications require extensions beyond the base PHP installation. Accordingly, install a comprehensive set covering WordPress, Laravel, and general PHP development needs:

sudo apt install php8.2-{curl,mysql,gd,opcache,zip,intl,common,bcmath,imagick,xmlrpc,readline,memcached,redis,mbstring,apcu,xml,soap}

JSON support is built into PHP 8.0 and later, so no separate php8.2-json package exists. The php8.2-xml package provides DOM, SimpleXML, XMLReader, and XMLWriter support. The php8.2-mysql package includes both MySQLi and MySQLnd drivers.

After installation, restart your PHP handler to load the new extensions. For PHP-FPM users:

sudo systemctl restart php8.2-fpm

If you installed PHP 8.2 with Apache mod_php instead of PHP-FPM, restart Apache to load the new extensions: sudo systemctl restart apache2

Subsequently, verify the core extensions are loaded:

php8.2 -m | grep -E 'curl|mysqli|gd|mbstring|xml'

Expected output showing the extensions are active:

curl
gd
libxml
mbstring
mysqli
xml
xmlreader
xmlwriter

PHP 8.2 Extension Reference for Ubuntu

For reference, the extensions above provide these capabilities:

  • php-curl: HTTP client for API requests and remote file operations.
  • php-mysql: MariaDB and MySQL database connectivity via MySQLi and MySQLnd.
  • php-gd: Image creation and manipulation (thumbnails, watermarks, captchas).
  • php-opcache: Bytecode caching to reduce PHP compilation overhead.
  • php-zip: ZIP archive creation and extraction.
  • php-intl: Internationalization including number formatting, date handling, and collation.
  • php-bcmath: Arbitrary precision mathematics for financial calculations.
  • php-imagick: Advanced image processing through ImageMagick.
  • php-xmlrpc: XML-RPC protocol support for remote procedure calls.
  • php-memcached and php-redis: Distributed caching backends for session storage and object caching.
  • php-mbstring: Multibyte string handling for UTF-8 and international text processing.
  • php-apcu: In-memory user data cache for frequently accessed application data.
  • php-xml: XML parsing including DOM, SimpleXML, and XSL support.
  • php-soap: SOAP web services client and server functionality.

Search Available PHP 8.2 Extensions

To explore additional options, you can list all available PHP 8.2 modules from the repository:

apt search php8.2-

Sample output showing available extensions:

Sorting...
Full Text Search...
php8.2-amqp/noble 2.x.x amd64
  AMQP extension for PHP

php8.2-apcu/noble 5.x.x amd64
  APC User Cache for PHP

php8.2-bcmath/noble 8.2.x amd64
  Bcmath module for PHP

[additional packages...]

List Loaded PHP 8.2 Modules

Alternatively, display all currently active PHP modules:

php8.2 -m

Sample output showing loaded modules:

[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
gd
hash
iconv
intl
json
libxml
mbstring
mysqli
openssl
pcre
PDO
pdo_mysql
Phar
readline
Reflection
session
SimpleXML
sockets
sodium
SPL
standard
tokenizer
xml
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Install PHP 8.2 Development Tools

Additionally, for code coverage analysis and extension development, install these packages:

sudo apt install php8.2-xdebug php8.2-pcov php8.2-dev

The php8.2-xdebug extension significantly impacts performance. Install it only on development systems, not production servers. For production-safe code coverage, use php8.2-pcov instead.

Specifically, the php8.2-pcov package provides lightweight code coverage reporting compatible with PHPUnit, while php8.2-dev includes headers and tools for compiling PHP extensions from source.

Configure PHP 8.2 Settings

Locate PHP 8.2 Configuration Files on Ubuntu

PHP 8.2 maintains separate configuration files for CLI (command line) and PHP-FPM (web server). Consequently, to find the active configuration file for each environment, run:

php8.2 --ini | head -3

Expected output showing CLI configuration paths:

Configuration File (php.ini) Path: /etc/php/8.2/cli
Loaded Configuration File:         /etc/php/8.2/cli/php.ini
Scan for additional .ini files in: /etc/php/8.2/cli/conf.d

For PHP-FPM (used by Apache with PHP-FPM or Nginx), the configuration file is at /etc/php/8.2/fpm/php.ini instead. Notably, changes to CLI settings do not affect web applications, and vice versa.

Adjust Common PHP 8.2 Settings

To modify settings for web applications using PHP-FPM, edit the FPM configuration file:

sudo nano /etc/php/8.2/fpm/php.ini

Common settings to adjust based on your application requirements:

; Maximum upload file size (default: 2M)
upload_max_filesize = 64M

; Maximum POST data size (must be >= upload_max_filesize)
post_max_size = 64M

; Maximum memory per script (default: 128M)
memory_limit = 256M

; Maximum script execution time in seconds (default: 30)
max_execution_time = 120

; Maximum input variables (default: 1000)
max_input_vars = 3000

After making changes, restart PHP-FPM to apply them:

sudo systemctl restart php8.2-fpm

Then verify the new settings are active by creating a PHP info page or using the command line:

php8.2 -i | grep upload_max_filesize

Expected output confirming the new value:

upload_max_filesize => 64M => 64M

Run Multiple PHP Versions on Ubuntu

How Multiple PHP Versions Work Together on Ubuntu

The Sury PPA packages each PHP version independently, so installing PHP 8.2 does not remove existing PHP installations. As a result, you can run PHP 8.1, 8.2, and 8.3 simultaneously, assigning different versions to different virtual hosts or projects.

Switch the Ubuntu CLI PHP Version with update-alternatives

To manage CLI versions, use update-alternatives to configure which PHP version responds to the php command:

sudo update-alternatives --config php

You will then see interactive output showing available versions:

There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/php8.3   83        auto mode
  1            /usr/bin/php8.2   82        manual mode
  2            /usr/bin/php8.3   83        manual mode

Press <enter> to keep the current choice[*], or type selection number:

Enter the number corresponding to your preferred version. Alternatively, to set PHP 8.2 directly without the interactive prompt:

sudo update-alternatives --set php /usr/bin/php8.2

Switch the Apache mod_php Version on Ubuntu

Similarly, when using mod_php with Apache, first disable the current PHP module and then enable the desired version:

sudo a2dismod php8.3
sudo a2enmod php8.2
sudo systemctl restart apache2

Switch the Apache PHP-FPM Version on Ubuntu

For Apache with PHP-FPM, instead swap the configuration files:

sudo a2disconf php8.3-fpm
sudo a2enconf php8.2-fpm
sudo systemctl restart apache2

Switch the Nginx PHP-FPM Socket Version on Ubuntu

Likewise, for Nginx, update the fastcgi_pass directive in your server block to point to the desired PHP-FPM socket:

# For PHP 8.2
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;

# For PHP 8.3
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;

After making changes, test and reload Nginx:

sudo nginx -t && sudo systemctl reload nginx

Compare PHP 8.2 With Other PHP Versions on Ubuntu

Compare Available PHP Versions on Ubuntu

After installing PHP 8.2, it helps to compare where it fits in the broader Ubuntu PHP ecosystem. Ubuntu repositories and the Sury PPA target different use cases, release timelines, and compatibility requirements.

PHP VersionPrimary FocusSupport StatusBest ForTrade-offs
PHP (Distro Default)Stability with Ubuntu security team maintenanceMatches Ubuntu release lifecycleProduction servers prioritizing official Ubuntu updates and minimal external dependenciesVersion varies by release (8.4 on 26.04, 8.3 on 24.04, 8.1 on 22.04)
PHP 8.5URI extension, pipe operator, clone with propertiesActive support through December 2027; security through December 2029Modern applications using functional programming patterns, URL parsing, and immutable object patternsRequires Sury PPA; newest release
PHP 8.4Property hooks, asymmetric visibility, #[\Deprecated] attributeActive support through December 2026; security through December 2028Production applications using modern OOP patterns, type-safe APIs, and improved deprecation handlingDefault on 26.04; requires Sury PPA on older releases
PHP 8.3Typed class constants, json_validate(), readonly property cloningSecurity-only through December 2027 (active support ended)WordPress 6.x, Laravel 11, Drupal 10 sites needing stable features with long security supportDefault on 24.04; security patches only on Sury PPA
PHP 8.2Readonly classes, DNF types, standalone null/false/true typesSecurity-only through December 2026 (active support ended)Legacy applications requiring PHP 8.2 compatibilityNo new features; security patches only

PHP 8.2 remains a practical compatibility target for older applications, but it is now a security-maintenance branch. For new deployments, PHP 8.5 or PHP 8.4 is usually a better long-term choice unless your application explicitly requires PHP 8.2.

Review PHP 8.2 Feature Highlights

PHP 8.2 still brings meaningful improvements for applications that cannot move to newer branches yet. Readonly classes reduce repetitive immutable property declarations, and Disjunctive Normal Form (DNF) types support combined union and intersection typing such as (A&B)|C for more precise type constraints.

Standalone null, false, and true types simplify validation and return signatures, and the Random extension provides a modern object-oriented API for random number generation. For the full feature list, review the official PHP 8.2 release announcement.

Troubleshoot PHP 8.2 Installation Issues

Unable to Locate the PHP 8.2 Package on Ubuntu

If apt cannot find php8.2, you are usually installing from Ubuntu’s default repositories without the ondrej/php PPA, or you are on Ubuntu 26.04 where the PPA does not currently publish a resolute repository.

Error: Unable to locate package php8.2
Error: Couldn't find any package by glob 'php8.2'

First, check which PHP version your Ubuntu release provides by default:

apt-cache policy php-cli php8.2 php8.2-cli

Typical output on Ubuntu 24.04 or 26.04 without the PPA shows only the default php-cli package candidate:

php-cli:
  Candidate: 2:8.3+...   # Ubuntu 24.04

# Ubuntu 26.04 shows PHP 8.4.x instead and still no php8.2 entries

For Ubuntu 22.04 and 24.04, add the PPA and refresh APT metadata:

sudo add-apt-repository ppa:ondrej/php -y
sudo apt update

Ubuntu 26.04 currently returns a missing Release file for ppa:ondrej/php (resolute). Use Ubuntu 26.04’s default PHP packages for now, or wait until the PPA publishes resolute packages before retrying PHP 8.2 installation.

Then verify the PHP 8.2 package names are available before installing:

apt-cache policy php8.2 php8.2-cli php8.2-fpm

Expected output on Ubuntu 22.04 or 24.04 shows PHP 8.2 candidates for all three package names:

php8.2:
  Candidate: 8.2.x-...+deb.sury.org+1
php8.2-cli:
  Candidate: 8.2.x-...+deb.sury.org+1
php8.2-fpm:
  Candidate: 8.2.x-...+deb.sury.org+1

PHP 8.2 FPM Socket Not Found in Nginx

If Nginx returns a 502 Bad Gateway error, first check the Nginx error log for socket connection failures:

sudo tail -5 /var/log/nginx/error.log

A common error indicating PHP-FPM is not running looks like this:

connect() to unix:/var/run/php/php8.2-fpm.sock failed (2: No such file or directory) while connecting to upstream

Next, verify the PHP-FPM socket exists:

ls -la /var/run/php/php8.2-fpm.sock

Expected output when the socket exists:

srw-rw---- 1 www-data www-data 0 [date] [time] /var/run/php/php8.2-fpm.sock

Conversely, if the socket is missing, check PHP-FPM status and then start the service:

sudo systemctl status php8.2-fpm
sudo systemctl enable php8.2-fpm --now

Afterward, verify the socket now exists and test the configuration:

ls -la /var/run/php/php8.2-fpm.sock
sudo nginx -t && sudo systemctl reload nginx

Expected output shows the socket path and a successful Nginx configuration test:

srw-rw---- 1 www-data www-data 0 [date] [time] /var/run/php/php8.2-fpm.sock
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Wrong PHP Version Active After Installing PHP 8.2

Occasionally, if php --version shows an older PHP version after installing 8.2, you need to update the alternatives system:

sudo update-alternatives --set php /usr/bin/php8.2

Subsequently, verify the change took effect:

php --version

Expected output confirming PHP 8.2 is now the default:

PHP 8.2.x (cli) (built: [date]) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.x, Copyright (c) Zend Technologies

PHP 8.2 Extension Not Loading After Installation

If an extension appears installed but is not loading, first confirm it is installed:

dpkg -l | grep php8.2-curl

Expected output showing the package is installed:

ii  php8.2-curl  8.2.x-1+ubuntu24.04.1+deb.sury.org+1  amd64  CURL module for PHP

Then check if the extension is enabled in the PHP configuration:

php8.2 -m | grep curl

Expected output showing the extension is enabled:

curl

If the extension is installed but not appearing, restart the PHP handler:

# For PHP-FPM
sudo systemctl restart php8.2-fpm

# For Apache mod_php
sudo systemctl restart apache2

Update PHP 8.2 on Ubuntu

PHP 8.2 receives updates through the Sury PPA. Consequently, to update to the latest point release while keeping other system packages unchanged, run:

sudo apt update
sudo apt install --only-upgrade 'php8.2*'

This command updates all PHP 8.2 packages (CLI, FPM, extensions) without upgrading unrelated system packages. After updating, restart PHP-FPM to apply changes:

sudo systemctl restart php8.2-fpm

Then, verify the new version:

php8.2 --version

Expected output confirms the updated PHP 8.2 CLI version is active:

PHP 8.2.x (cli) (built: [date]) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.x, Copyright (c) Zend Technologies

Remove PHP 8.2 from Ubuntu

Uninstall PHP 8.2 Packages

To remove PHP 8.2 and its extensions while preserving other PHP versions, run:

sudo apt remove php8.2*

APT will then display the packages to be removed before proceeding:

The following packages will be removed:
  libapache2-mod-php8.2 php8.2 php8.2-cli php8.2-common php8.2-curl
  php8.2-fpm php8.2-gd php8.2-mbstring php8.2-mysql php8.2-opcache
  php8.2-xml php8.2-zip [additional packages...]

Alternatively, to remove configuration files as well, use purge instead of remove:

The purge command permanently deletes PHP configuration files in /etc/php/8.2/. If you have customized php.ini or pool configurations, back them up first.

sudo apt purge php8.2*

Finally, clean up any orphaned dependencies that were installed only for PHP 8.2:

sudo apt autoremove

Remove the Ondrej Sury PHP PPA from Ubuntu

If you no longer need packages from the Sury PPA, remove the configuration:

sudo add-apt-repository --remove ppa:ondrej/php -y
sudo apt update

After removing the PPA, verify PHP 8.2 is no longer available:

apt-cache policy php8.2

Expected output showing no installation candidate:

php8.2:
  Installed: (none)
  Candidate: (none)
  Version table:

PHP 8.2 Documentation and Reference Links

For additional resources and documentation:

  • PHP Official Website: Visit the official PHP website for information about the programming language, its features, and download options.
  • PHP 8.2 Release Notes: Explore the release notes for PHP 8.2 to learn about new features, improvements, and changes.
  • PHP 8.2 ChangeLog: Review the changelog for PHP 8 to see the detailed list of changes and updates in each release.
  • PHP Documentation: Access comprehensive documentation for detailed guides on using and programming with PHP.
  • PHP Supported Versions: Check current PHP version support status and end-of-life dates.

PHP 8.2 on Ubuntu Frequently Asked Questions

Is PHP 8.2 available in Ubuntu 24.04 default repositories?

No. Ubuntu 24.04 ships PHP 8.3.x in the default repositories. To install PHP 8.2 on Ubuntu 24.04, add the ondrej/php PPA and install the php8.2 packages from that repository.

Why does Ubuntu 26.04 show Unable to locate package php8.2?

Ubuntu 26.04 ships newer default PHP packages and the ondrej/php PPA currently does not publish a resolute Release file for PHP 8.2. Use Ubuntu 26.04’s default PHP packages for now or wait for resolute packages to be published in the PPA.

What are the Ubuntu package names for PHP 8.2 CLI and FPM?

The package names are php8.2-cli for the command line interpreter and php8.2-fpm for PHP-FPM. The base metapackage is php8.2, and many extensions follow the same pattern, such as php8.2-mysql and php8.2-xml.

Does this PHP 8.2 guide support Ubuntu 20.04?

No. Ubuntu 20.04 reached end of standard support in May 2025 and is not covered by this guide. Use Ubuntu 22.04 or 24.04 for PHP 8.2 with the ondrej/php PPA, or use the default PHP packages on Ubuntu 26.04.

Conclusion

PHP 8.2 is now running on Ubuntu with a workable maintenance path: PPA packages, Apache or Nginx integration, extension management, and version switching when you need it. Next, consider setting up phpMyAdmin with LEMP on Ubuntu, tuning Nginx FastCGI cache on Ubuntu, or deploying WordPress with Nginx and MariaDB on Ubuntu.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: