Tutorials  /  Linux Basics

Upgrade PHP 8.2 to PHP 8.3 on Ubuntu 24.04 – Step-by-Step Guide

Ccentron Redaktion · October 2025 ·5 min read ·Linux Basics, Tutorial

PHP is one of the most widely used server-side scripting languages for creating dynamic websites and web applications. Each release of PHP introduces performance improvements, language enhancements, and new modern capabilities. PHP 8.3 builds on the foundation of PHP 8.2 by adding features like explicit typing for class constants, readonly classes, deep cloning for readonly properties, and expanded function support.

This guide demonstrates how to upgrade PHP 8.2 to PHP 8.3 on Ubuntu 24.04. You will learn how to update the PHP repository sources, install PHP 8.3, configure PHP-FPM, and add common PHP extensions for use with Apache or Nginx web servers.

Prerequisites

Before you start, make sure the following requirements are met:

  • You have access to an Ubuntu 24.04 instance where PHP 8.2 is already installed.
  • You are logged in as a non-root user with sudo privileges to install and manage software packages.
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Add PHP PPA Repository

Ubuntu 24.04’s default APT repositories only include a limited set of PHP versions. To access newer versions such as PHP 8.3, you can add an external PHP PPA maintained by Ondřej Surý — a trusted source widely used within the PHP community. Follow these steps to install and enable the PPA repository.

Step 1: Update the Package Index

Console
$ sudo apt update

Step 2: Install Required Dependencies

Console
$ sudo apt install apt-transport-https ca-certificates software-properties-common -y

Step 3: Add the PHP PPA Repository

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

Step 4: Update the Package Index Again

Console
$ sudo apt update

List Installed PHP 8.2 Modules

Before performing the upgrade, it’s helpful to review which PHP 8.2 modules are currently installed. This will allow you to reinstall equivalent modules for PHP 8.3 afterward. Follow the steps below to view all active PHP 8.2 modules on your system.

Step 1: Display Active PHP Modules

Console
$ php -m

Step 2: List Installed PHP 8.2 Packages

Run the following command to display all PHP 8.2-related packages and save the list to a text file for reference.

Console
$ dpkg -l | grep php8.2 | tee packages.txt

Example output:

Code
php8.2                               server-side, HTML-embedded scripting language (metapackage)
php8.2-bz2                           bzip2 module for PHP
php8.2-cli                           command-line interpreter for the PHP scripting language
php8.2-common                        documentation, examples and common module for PHP
php8.2-curl                          CURL module for PHP
php8.2-fpm                           server-side, HTML-embedded scripting language (FPM-CGI binary)
php8.2-intl                          Internationalisation module for PHP
php8.2-mbstring                      MBSTRING module for PHP
php8.2-opcache                       Zend OpCache module for PHP
php8.2-readline                      readline module for PHP

Install PHP 8.3

After adding the PHP PPA, you can now install PHP 8.3 and its dependencies. PHP requires supporting libraries and web server integration tools to function properly. Follow the steps below to install PHP 8.3.

Step 1: Install PHP 8.3

Console
$ sudo apt install -y php8.3

Step 2: Verify the PHP Version

Console
$ php8.3 -v

Expected output:

Code
PHP 8.3.19 (cli) (built: Mar 13 2025 17:44:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.19, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.19, Copyright (c), by Zend Technologies

Step 3: Check Installed PHP Versions

Console
$ ls /etc/php

You should now see both PHP 8.2 and PHP 8.3 directories, confirming the new version was successfully installed.

Code
8.2  8.3

Optional: Uninstall PHP 8.2

Removing PHP 8.2 helps ensure PHP 8.3 becomes the default version on your system. It also reclaims disk space and avoids potential PHP-FPM conflicts on the default port 9000.

Step 1: Remove the Base PHP 8.2 Package

Use the following command to uninstall the main PHP 8.2 package using APT.

Console
$ sudo apt remove -y php8.2

Step 2: Purge All PHP 8.2 Packages

Completely remove PHP 8.2-related extensions, configuration files, and dependencies.

Console
$ sudo apt purge php8.2*

Step 3: Remove Unused Dependencies

Clean up residual dependencies no longer needed by PHP 8.2.

Console
$ sudo apt autoremove -y

Step 4: Verify the Active PHP Version

Run the following command to confirm that PHP 8.3 is now the active version on your system.

Console
$ php -v

Example output:

Code
PHP 8.3.20 (cli) (built: Apr 10 2025 21:33:50) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.20, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.20, Copyright (c), by Zend Technologies

Conclusion

You have successfully upgraded from PHP 8.2 to PHP 8.3 on Ubuntu 24.04. In this process, you installed core PHP extensions, configured PHP-FPM in your web server, and removed PHP 8.2 to ensure PHP 8.3 remains the default version. It’s also possible to maintain multiple PHP versions on the same machine and switch between them as needed for different projects. For advanced configurations and detailed documentation, refer to the official PHP documentation.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Unser Team hilft Ihnen bei Ihrem konkreten Setup weiter – von Menschen, die die Plattform selbst betreiben.

War dieses Tutorial hilfreich?

Ihre Antwort wird anonym gespeichert und hilft uns, die Tutorials zu verbessern.

Kommentare

Noch keine Kommentare – stellen Sie die erste Frage zu diesem Tutorial.

Zum Kommentieren anmelden

Kommentare stehen centron-Kunden offen. Melden Sie sich in Ihrem Konto an, um eine Frage zu diesem Tutorial zu stellen.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren