faild to install PHP 8.3 on Ubuntu 20.04

faild to install PHP 8.3 on Ubuntu 20.04

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Why PHP 8.3 Fails to Install on Ubuntu 20.04 and How to Fix It

Attempting to run sudo apt-get install php8.3 on Ubuntu 20.04 immediately returns a "Unable to locate package" error. This is not a bug in your system; it is a consequence of how Ubuntu manages software repositories. The official Ubuntu 20.04 ("Focal Fossa") release, even at version 20.04.6 LTS, ships with PHP 8.1 as its latest supported version. PHP 8.3 was released after the initial launch of Ubuntu 20.04 and is not included in the default main, restricted, or universe repositories maintained by Canonical.

When you run apt policy php8.3 or apt-cache search php8.3 without external sources, the package manager naturally returns nothing. To access newer versions like 8.3, you must add a third-party Personal Package Archive (PPA). The standard solution for Ubuntu users is the ondrej/php PPA, managed by Ondřej Surý, a prominent maintainer in the PHP ecosystem.

Adding this repository changes your system's package sources. After adding ppa:ondrej/php, you must update the local package index before installing anything new. Running the following command refreshes the metadata from all configured sources, including the newly added PPA:

sudo apt update

Once the index is updated, the basic PHP installation works as expected:

sudo apt install php8.3

However, a common pitfall arises when trying to install specific extensions immediately after upgrading PHP. You might find that while php8.3 installs successfully, commands like sudo apt install php8.3-gmp fail with the same "Unable to locate package" error. This discrepancy is confusing but has a straightforward explanation.

The ondrej/php PPA organizes packages into distinct sections (e.g., main, dev, bionic). While the core PHP binaries are available, not every extension is immediately available for every major version once the base package is installed. Sometimes, extensions like gmp for PHP 8.3 require a manual refresh or might be located under a different naming convention depending on the specific build cycle.

To resolve the missing extension issue, ensure you have run sudo apt update again after installing the core PHP version. If the package still does not appear, verify that the PPA is correctly enabled and active for your release codename (focal):

cat /etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list

The output should confirm a line starting with deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main. If the PPA is missing or pointing to an incorrect codename, you will not be able to install version-specific extensions.

It is also worth noting that Ubuntu 20.04 reached the end of standard support in April 2025. While Extended Security Maintenance (ESM) keeps the OS secure, relying on rolling releases via PPAs introduces a slight risk of dependency conflicts if your application stack becomes fragmented. For production environments where stability is paramount, consider whether sticking to PHP 8.1 (the default for Ubuntu 20.04) or upgrading the entire OS to Ubuntu 22.04 ("Jammy Jellyfish") is a more sustainable long-term strategy than managing multiple PHP versions on an older kernel and glibc stack.

If you are developing with Laravel, staying within the supported lifecycle of your operating system ensures that underlying system libraries do not break your composer dependencies or cause memory issues with newer PHP features. For projects requiring the very latest PHP version immediately, Ubuntu 22.04 is now the recommended baseline to avoid these repository fragmentation headaches entirely.

Our network