How to Install PHP 8.3 on Debian and Ubuntu: A Complete Guide
Installing PHP version 8.3 is a very important step for those who want to use all the advantages of the new version of the popular programming language for web development. With the release of PHP 8.3, webmasters receive new sets of language functions, improved performance and security of their projects. New language capabilities make PHP attractive for creating modern and highly loaded applications.
At the time of writing, PHP 8.3 was the latest version for the Debian distribution in the Sury PPA repository.
If you have Debian or Ubuntu operating system installed and you want to install PHP 8.3, then this article will help you to understand the installation step by step.
We will install PHP 8.3 on Debian 12. No need to worry if you have another operating system installed instead of Debian, for example Ubuntu, the installation process will be the same as on Debian.
To avoid any problems installing PHP on your system, you must have sudo privileges or perform all actions as root user.
The article on the page is based on my many years of experience with this technology and is presented to you as a small instruction, but if you want to get acquainted with it in more detail, then I recommend you go to the official documentation on PHP.
Contents of the article:
- Repository updates.
- Checking the current PHP version.
- Installing SURY PPA repository.
- Installing PHP.
1. Repository updates.
First, we will update our system by updating all packages to the latest versions. To update packages, we use the command:
~# apt update && apt upgrade
2. Checking the current PHP version.
Debian has a cool feature to view all available PHP versions for installation. To do this, use the command:
~# apt list -a php
As a result, we see that we only have PHP 8.2 in our repository.
If we want to see the name of the repository itself where PHP is located, then we use the command:
~# apt-cache madison php
As a result, we received not only the name of the PHP version, but also the name of the repository itself in which PHP itself is located.
3. Installing SURY PPA repository.
If we want to install PHP 8.3, we need to install a third-party repository from Sury PPA. The Sury PPA repository already contains the latest version of PHP for Debian-based systems. To install the Sury PPA repository, use the command:
~# sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
~# echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
After installing the Sury PPA repository, we still won't be able to install php version 8.3 because we need to re-run the package update command.
~# apt update
After running the package update command, we can now re-check which versions of PHP are available for us to install. To check, we use the same command as above:
~# apt list -a php
~# apt-cache madison php
And now we see that we have a new repository and in this repository the php 8.3 version is available for installation as we wanted.
4. Installing PHP.
After all that we have done, all that remains is to install php on our system. To install, use the command:
~# apt install php
As a result, we see that the PHP packages that want to be installed on our system begin with the words php8.3-{package name}.
After installing the packages, let's finally check what version of PHP has been installed on our system. To check the version of PHP, we use a very simple command:
~# php -v
As a result, we see that we have PHP version 8.3 installed, as we wanted.
As a result, today we looked at a simple way to install the latest version of PHP 8.3 on the Debian 12 operating system using the third-party repository Sury PPA.