How to Install PHP 8.3 on Ubuntu 22.04?

By Hardik Savani November 25, 2023 Category : PHP Ubuntu

Hello Developers,

This article provides a comprehensive guide on installing PHP 8.3 on Ubuntu 22.04. You'll gain insights into the process of installing PHP 8.3 on this Ubuntu version, presented through a straightforward example. The steps for installing PHP 8.3 on Ubuntu 22.04 are explained in detail, offering a step-by-step walkthrough. Let's kick off the installation of PHP 8.3 on Ubuntu 22.04.

It's important to note that as of November 2023, Ubuntu 22.04 has not been officially released. The most recent stable version is Ubuntu 21.10 (Impish Indri). However, you can still proceed with installing PHP 8.3 on Ubuntu 23.04 by following these simple steps, which I'll outline for you.

Let's see the simple steps:

Step 1: Run System Updates

To ensure that our repositories are up to date, the first step in a new system is to update them. Additionally, it is essential to run the upgrade command.

sudo apt update

Step 2: Add Ondrej Sury PPA Repository

To run PHP 8.3 on Ubuntu 22.04, it is necessary to include Ondrej Sury's PPA in our system. Ondrej Sury is currently responsible for maintaining the PHP repository. However, please note that this PPA is not currently verified, so there is no guarantee of obtaining 100% reliable results when installing from it.

To add this PPA, execute the following command in our terminal.

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt update

Step 3: Install PHP 8.3 and Common Extensions

We should now be able to install PHP 8.3 on Ubuntu 22.04 Linux machine. The commands to run are as shared below:

sudo apt install php8.3

sudo apt install php8.3-cli php8.3-common php8.3-json php8.3-opcache php8.3-mysql php8.3-mbstring php8.3-zip php8.3-fpm php8.3-xml php8.3-bcmath php8.3-gd php8.3-curl php8.3-intl php8.3-redis php8.3-imagick

Now, you can check your php version using following command:

php -v

I hope it can help you...

Tags :