Good news! PHP 8.3 is being actively supported through 31 Dec 2025. After that point, it's advisable to upgrade to the latest version, since the PHP team will only offer security-related support until 31 Dec 2027, at which point PHP 8.3 will be considered "end-of-life".
Update the package list:
sudo apt update
Install required packages:
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
Add the Sury PHP repository:
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
Import the repository GPG key:
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
Update the package list again:
sudo apt update
Install PHP 8.3 and common extensions:
sudo apt install -y php8.3 php8.3-cli php8.3-common php8.3-curl php8.3-mbstring php8.3-mysql php8.3-xml
Check the installed PHP version:
php -v
This should display the PHP version 8.3.x
Verify PHP configuration:
php -i
This will show detailed PHP configuration information
Check installed PHP modules:
php -m
This will list all installed PHP modules