How to Upgrade PHP 8.2 to 8.3 in Ubuntu

Keeping your PHP version up to date is essential for taking advantage of new features, performance improvements, and security updates. If you're using PHP 8.2 and want to upgrade to PHP 8.3 on Ubuntu, this guide is for you.

I'll show you the step-by-step process in simple language so you can quickly upgrade your PHP version without hassle.

How to Upgrade PHP 8.2 to 8.3 in Ubuntu

How to Upgrade PHP 8.2 to 8.3 in Ubuntu

 

Step 1: Check Your Current PHP Version

Before upgrading, confirm the PHP version installed on your system:

php -v

If it shows PHP 8.2, you're ready to upgrade to 8.3.

 

Step 2: Add the PHP PPA Repository

The PHP 8.3 package is available via the Ondřej Surý PPA, a popular repository for PHP versions. Add it to your system:

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

 

Step 3: Update the Package List

After adding the PPA, update your system's package list:

sudo apt update

 

Step 4: Install PHP 8.3

Now, install PHP 8.3 by running the following command

sudo apt install -y php8.3

 

Step 5: Install PHP 8.3 Extensions

If your application uses specific PHP extensions, install them for PHP 8.3. For example:

sudo apt install php8.3-common php8.3-mysql php8.3-xml php8.3-xmlrpc php8.3-curl php8.3-gd php8.3-imagick php8.3-cli php8.3-dev php8.3-imap php8.3-mbstring php8.3-opcache php8.3-soap php8.3-zip php8.3-intl -y

 

Step 6: Switch to PHP 8.3

To make PHP 8.3 the default version, use the update-alternatives command:

sudo update-alternatives --set php /usr/bin/php8.3

Verify the version again to ensure PHP 8.3 is active:

php -v

 

Step 7: Restart Your Web Server

Restart Apache or PHP-FPM to apply the changes:

For Apache:

sudo systemctl restart apache2

For PHP-FPM (if using Nginx):

sudo systemctl restart php8.3-fpm

 

Step 8: Remove Older PHP Versions (Optional)

If you're no longer using PHP 8.2, you can safely remove it to free up space:

sudo apt remove -y php8.2
sudo apt autoremove -y

 


You might also like:

techsolutionstuff

Techsolutionstuff | The Complete Guide

I'm a software engineer and the founder of techsolutionstuff.com. Hailing from India, I craft articles, tutorials, tricks, and tips to aid developers. Explore Laravel, PHP, MySQL, jQuery, Bootstrap, Node.js, Vue.js, and AngularJS in our tech stack.

RECOMMENDED POSTS

FEATURE POSTS