Installing PHP 8.4 on Ubuntu 24.04 via Sury Repository

PHP 8.4 is a development/pre-release version of PHP introducing new features and performance improvements. This guide explains how to install PHP 8.4 on Ubuntu 24.04 (Noble Numbat) using the Sury APT repository, which maintains up-to-date PHP builds.

PHP 8.4 is under active development (alpha/beta as of May 2025). Do not use it in production environments.

Prerequisites

Ensure your system is up to date and has required packages installed.

Update System Packages

apt update && apt upgrade -y

Install Required Packages

apt install -y apt-transport-https lsb-release ca-certificates curl gnupg2

Use Ondřej's Launchpad PPA instead (more stable for Ubuntu)

Ondřej also maintains a Launchpad PPA, which is much more stable and intended for Ubuntu:

add-apt-repository ppa:ondrej/php

Update Package Index

apt update

Install PHP 8.4 and Extensions

Install PHP 8.4 with commonly used extensions.

apt install -y php8.4 php8.4-cli php8.4-mysql php8.4-zip php8.4-xml php8.4-gd php8.4-curl php8.4-mbstring php8.4-bcmath php8.4-soap php8.4-readline php8.4-intl php8.4-common

Add or remove extensions as needed for your applications.

Verify PHP Installation

Check the PHP version:

php -v

Expected output should begin with:

root@vps:~# php -v
PHP 8.4.7 (cli) (built: May  9 2025 06:54:31) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.7, Copyright (c), by Zend Technologies

Conclusion

You’ve now successfully installed PHP 8.4 on Ubuntu 24.04 using the Sury APT repository.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS