How to Install PHP 8.3 on Ubuntu 22.04?

This article provides a comprehensive guide on installing PHP 8.3 on Ubuntu 22.04

How to Install PHP 8.3 on Ubuntu 22.04?

Here are the steps to install PHP 8.3 on Ubuntu 22.04:

Step 1: Run System Updates

Ensure that your repositories are up to date by running the update command:

sudo apt update

Step 2: Add Ondrej Sury PPA Repository

To install PHP 8.3 on Ubuntu 22.04, you need to include Ondrej Sury's PPA repository:

sudo apt install software-properties-common 
sudo add-apt-repository ppa:ondrej/php 
sudo apt update

Please note that Ondrej Sury's PPA is not officially verified, so there may be some risks involved.

Step 3: Install PHP 8.3 and Common Extensions

Now, you can install PHP 8.3 along with common extensions by executing the following commands:

sudo apt install php8.3 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

Step 4: Check PHP Version

You can verify that PHP 8.3 has been installed successfully by checking the version:

php -v

This command will display the PHP version currently installed on your system.

That's it! You've successfully installed PHP 8.3 on Ubuntu 22.04. You can now start using PHP 8.3 for your development projects.