How to Install PHP 8.3 on Ubuntu 23.10
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 read-only 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 Ubuntu 23.10, you can use the ondrej/php
repository, which provides up-to-date PHP versions.
Below are the steps to install PHP 8.3 on Ubuntu 23.10
Update the System
Update and Upgrade System Packages,
apt update -y
apt upgrade -y
Install PHP 8.3
Install Software Properties Common,
apt install software-properties-common
Add PHP Repository,
add-apt-repository ppa:ondrej/php
Edit the PHP Repository File,
nano /etc/apt/sources.list.d/ondrej-ubuntu-php-mantic.sources
Change the suits from the mantic
version to jammy
,
Types: deb
URIs: https://ppa.launchpadcontent.net/ondrej/php/ubuntu/
Suites: mantic
Components: main
to
Types: deb
URIs: https://ppa.launchpadcontent.net/ondrej/php/ubuntu/
Suites: jammy
Components: main
Run the update command again,
apt update
Create a preference file for Ondrej's PHP repository by creating the file '/etc/apt/preferences.d/ondrejphp' and adding the below content,
Package: libgd3
Pin: release n=mantic
Pin-Priority: 900
Install PHP 8.3,
apt install php8.3 php8.3-cli php8.3-fpm
Install Additional PHP Extensions,
apt install php8.3-{mysql,curl,xsl,gd,common,xml,zip,xsl,soap,bcmath,mbstring,gettext}
Check and verify PHP 8.3 is installed by running the below command,
php -v
Output:
root@server:~# php -v
PHP 8.3.0 (cli) (built: Nov 24 2023 08:50:08) (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
root@server:~#
You have successfully installed PHP 8.3 on Ubuntu 23.10, unlocking the latest features and improvements in PHP development.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS