How to Install PHP 8 on Ubuntu 20.04
To Ensure system updated.
apt update
If any update is available update the system and reboot.
apt upgrade -y && reboot
Add PHP PPA Repository
apt -y install software-properties-common
add-apt-repository ppa:ondrej/php
Output:
root@vps:~# add-apt-repository ppa:ondrej/php
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting
.
.
.
Hit:1 http://nl.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease [23.9 kB]
Hit:3 http://nl.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://nl.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:5 http://nl.archive.ubuntu.com/ubuntu focal-security InRelease
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages [74.8 kB]
Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main Translation-en [28.2 kB]
Fetched 127 kB in 1s (240 kB/s)
Reading package lists... Done
Install PHP 8
Ensure the added package is up to date.
apt update
If any update is available update the system and reboot.
apt upgrade -y && reboot
Install PHP 8 on Ubuntu
apt -y install php8.0
php -v
Output:
root@vps:~# php -v
PHP 8.0.0 (cli) (built: Nov 27 2020 12:26:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies
To Install php Extensions.
NOTE: Replace the required extensions name in the command
apt install php8.0-<extension>
To list installed php modules/extensions.
php -m
This concludes our topic of installing PHP 8 on the Ubuntu 20.04 system.
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