Installing PHP 8.3 on Debian 12

Hello,
In this week’s feature highlight, we look at How to Install PHP 8.3 on Debian 12

PHP 8.3 is a major update of the PHP language. It contains many new features, such as explicit typing of class constants, deep-cloning of readonly properties and additions to the randomness functionality. As always it also includes performance improvements, bug fixes, and general cleanup.

To install a specific version of PHP on Debian 12, you can use the ondrej/php repository, which provides up-to-date PHP versions. Below are the steps to install PHP 8.3 on Debian 12

Add the Ondrej PHP Repository

Install curl,

apt install curl -y

Add Repository Source and Key,

apt install apt-transport-https

curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg

sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

apt update

Install PHP 8.3

Install PHP and Extensions and extensions,

apt install php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl}

Install FPM or Apache Module,

apt install php8.3-fpm

Check PHP Version using below command,

php -v

Output:

root@vps:~# php -v
PHP 8.3.0 (cli) (built: Nov 25 2023 14:38:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.0, Copyright (c), by Zend Technologies

You have successfully installed PHP 8.3 on Debian 12, unlocking the latest features and improvements in PHP development.

(Visited 345 times, 1 visits today)