Installing PHP 8.4 on Debian 12 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 Debian 12 (Bookworm) 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 tools installed.

Update System Packages

apt update && apt upgrade -y

Install Required Packages

Install required packages for managing repositories and certificates:

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

Add Sury PHP Repository

Sury's repository contains all current PHP versions, including pre-release builds.

Import Sury GPG Key

curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-php.gpg

Add the Repository to APT Sources

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list

Update Package Index

apt update

Install PHP 8.4 and Extensions

Now install PHP 8.4 and common extensions.

apt install -y php8.4 php8.4-cli php8.4-fpm 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

You can add or remove extensions based on your application’s needs.

Verify PHP Installation

Check the installed PHP version:

php -v

Output:

root@vps:~# php -v
PHP 8.4.7 (cli) (built: May  9 2025 07:02:39) (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 Debian 12 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