How to Install PHP 8.3 on Ubuntu 26.04

How to Install PHP 8.3 on Ubuntu 26.04

In this blog post, we will show you how to install PHP 8.3 on Ubuntu 26.04. PHP (Hypertext Preprocessor) is a widely used server-side scripting language designed mainly for web development. It runs on a web server and generates dynamic content that is sent to the user’s browser. PHP is commonly used to build websites and web applications by interacting with databases, handling forms, managing sessions, and creating personalized content. For example, PHP can process login systems, upload files, or display information stored in a database. It works well with databases such as MySQL and can be embedded directly into HTML. Because it is open-source, easy to learn, and supported by many hosting services, PHP remains a popular choice for developing dynamic websites. Moreover, the steps in this guide are tailored specifically for those who want to install PHP 8.3 on Ubuntu 26.04.

Supported Ways for installing PHP 8.3 on Ubuntu 26.06

There are 2 supported ways to install PHP 8.3 on Ubuntu 26.04, and the installation time depends on the method used. Both approaches are suitable if your goal is to install PHP 8.3 on Ubuntu 26.04.

PHP 8.3 is NOT in the default Ubuntu 26.04 (non-LTS) apt repositories because Ubuntu’s default repositories freeze software versions early in the release cycle to ensure stability, and they do not always include the absolute latest PHP release. To get PHP 8.3, you must use a third-party PPA such as ppa:ondrej/php.

The ppa:ondrej/php PPA is designed primarily for current, stable Ubuntu LTS releases and supported, non-EOL PHP versions. While it supports Ubuntu 22.04 and 24.04, support for future versions like 26.04 (due April 2026) will depend on whether Ondřej Surý maintains it for that release. At the moment we write the tutorial, the PPA Ondrej was not supported for Ubuntu 26.04.

One of the supported methods is installing PHP 8.3 from source. Installing PHP 8.3 from source means downloading the raw, uncompiled source code, configuring it to match the system’s specifications, compiling it with a compiler (like GCC), and installing it manually. Unlike installing via a package manager (apt, yum, brew), this method bypasses pre-packaged binaries.

The second supported method is using a Docker container. PHP 8.3 can also run inside a Docker container without installing it directly on Ubuntu.

We will explain these two methods in the next headings. Let’s get started!

Prerequisites

Update the System

Before we start installing PHP 8.3, we will update the system packages to their latest versions. Execute the following command to help prepare for the process of installing PHP 8.3 on Ubuntu 26.04.

apt update -y && apt upgrade -y

Method 1. Building PHP from Source

The installation of PHP 8.3 on Ubuntu 26.04 from source requires downloading PHP 8.3, configuring and compiling, and finally installing. We will go through all these steps, but first, we need to install some prerequisites:

apt install -y build-essential libxml2-dev libsqlite3-dev zlib1g-dev libcurl4-openssl-dev libonig-dev libzip-dev libpng-dev libjpeg-dev libfreetype6-dev libssl-dev pkg-config

Once the prerequisites are installed, we can download the PHP 8.3 source files:

cd /opt

wget https://www.php.net/distributions/php-8.3.20.tar.gz

tar -xzf php-8.3.20.tar.gz

cd php-8.3.20

Next is to configure the PHP with the PHP extensions:

./configure --prefix=/usr/local/php8.3 \
--with-config-file-path=/usr/local/php8.3/etc \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-mysqli \
--with-pdo-mysql \
--with-openssl \
--with-zlib \
--with-curl \
--with-gd \
--with-mbstring \
--enable-intl \
--enable-zi

Once, compile the PHP with the following command:

make -j$(nproc)

You should allow some time for the compilation process to finish. It took 10 minutes when we compiled it. Once the compilation is done, we can install PHP 8.3 with the command below:

make install

After the installation, we need to make a symbolic link:

ln -s /usr/local/php8.3/bin/php /usr/bin/php

Now you can check the installed version with the following command:

php -v

You should get the following output:

root@host:/opt/php-8.3.20# php -v
PHP 8.3.20 (cli) (built: Mar 7 2026 06:11:31) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.20, Copyright (c) Zend Technologies

Method 2. Installing PHP 8.3 using Docker Container

First, we need to install the Docker service:

apt update -y

apt install docker.io -y

Once installed, start and enable the Docker service:

systemctl start docker && systemctl enable docker

To check the status of the Docker service, you can use the following command:

systemctl status docker

You should get output similar to this:

root@host:~# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
Active: active (running) since Sat 2026-03-07 09:21:32 CST; 5min ago
Invocation: 8456a833e7a148909a9f325eb1fb25a5
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 117557 (dockerd)
Tasks: 10
Memory: 29.6M (peak: 86.8M)
CPU: 12.441s
CGroup: /system.slice/docker.service
└─117557 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Now, when Docker is installed, we can pull the PHP 8.3 image from the Docker repositories:

docker pull php:8.3-cli

The process will start, and it should look like this:

root@host:~# docker pull php:8.3-cli
8.3-cli: Pulling from library/php
29f17720e7be: Pull complete
926bfbd3e67c: Download complete
f7de7bb0f053: Download complete
0e8d3ba128a5: Download complete
.
.
.
.
e0dbf5130f7b: Download complete
8388df94b723: Download complete
Digest: sha256:5e792a31b25c74d2453a7f06e0747c8b122879cc58bcefac66fa3699cd747e3a
Status: Downloaded newer image for php:8.3-cli
docker.io/library/php:8.3-cli

Once the image is downloaded, we can run the PHP 8.3 Docker container with the docker run –rm php:8.3-cli and the php command as we normally do:

docker run --rm php:8.3-cli php -v

You should receive the following output:

root@host:~# docker run --rm php:8.3-cli php -v
PHP 8.3.30 (cli) (built: Feb 24 2026 19:11:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.30, Copyright (c) Zend Technologies
with Zend OPcache v8.3.30, Copyright (c), by Zend Technologies

Because the container was started with the –rm flag, Docker will automatically remove the container after you exit.

Wrap Up!

That’s it all! You have successfully installed PHP 8.3 on Ubuntu 26.04 by following this tutorial.

If you are one of our customers and use our managed PHP hosting, you don’t have to follow this tutorial and install PHP 8.3 on Ubuntu 26.04 yourself. Our experienced Linux admins will set up and configure a PHP 8.3 for you. Additionally, you can contact us if you need assistance to install PHP 8.3 on Ubuntu 26.04. They are available 24×7 and will take care of your request immediately. Submit a ticket.

If you liked this post, please share it with your friends or leave a comment below.

Leave a Comment