Categories: Ubuntu

How to Install PHP 8.2 on Ubuntu 22.04|20.04|18.04

PHP 8.2 is the latest stable version of PHP. PHP (Hypertext PreProcessor) is a server-side scripting language that is widely used for web development. It is used to create dynamic web pages, and can be embedded directly into HTML code. It allows developers to create web applications that can interact with databases, perform calculations, and more. PHP 8.2 release has many new features, performance improvements and bug fixes. Some notable new features include: Just in time (JIT) compiler, union types, match expression, attributes, constructors promotion, and more.

In this article, you will learn how to install PHP 8.2 on Ubuntu 22.04|20.04|18.04

Sponsored
class=”wp-block-heading” id=”h-step-1-update-ubuntu-system”>Step 1: Update Ubuntu System

First, make sure that your Ubuntu system is up to date by running the following command:

sudo apt-get -y update

Step 2: Add PHP APT repository

Next, add the Ondrej PPA (personal package archive) to your system by running the following command:

sudo add-apt-repository ppa:ondrej/php

Once the PPA has been added, update your system’s package list by running:

sudo apt-get -y update

Step 3: Install PHP 8.2 on Ubuntu

Now you can install PHP 8.2 by running the following command:

sudo apt-get install -y php8.2

After the installation is complete, you can check which version of PHP you have installed by running the following command:

php -v

Step 4: Install PHP 8.2 modules on Ubuntu

To see the list of available modules, use the following command:

Sponsored
sudo apt-cache search php8.2-*

To install a specific module, use the following command (replace “module_name” with the name of the module you want to install):

sudo apt-get install -y php8.2-module_name

To check if a specific module is installed or not, you can use the following command:

php -m | grep module_name

To check the installed modules run

php -m

To check the php.ini location

php --ini

Note: You can also install multiple modules at once by separating the module names with a space, for example:

sudo apt-get install -y php8.2-module1 php8.2-module2 php8.2-module3

And that’s it! You have now successfully installed PHP 8.2 on your Ubuntu system.

The post How to Install PHP 8.2 on Ubuntu 22.04|20.04|18.04 appeared first on Osgrove.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

5 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago