Install PHP 8 on Ubuntu 20.04

WebTutPro
techiediaries.com
Published in
1 min readNov 28, 2020

Let’s see how to install Install PHP 8 on Ubuntu 20.04

Adding a PPA for PHP 8

Next, you need to use a PPA for PHP 8. Head back to your terminal and add the ondrej/php which contains the latest PHP 8 package and compatible PHP extensions:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Now you are ready to install PHP 8.

Installing PHP 8 for Apache Server

Let’s now see how to install PHP 8

Execute the following command to install PHP 8

sudo apt install php8.0

After the installation has completed, you can confirm the installation using the following command

php -v

Installing PHP 8 FPM for Nginx

For Nginx you need to install FPM, execute the following command to install PHP 8 FPM

sudo apt install php8.0-fpm

After the installation has completed, confirm that PHP 8 FPM has installed correctly with this command

php-fpm8.0 -v

Install PHP 8 Extensions

Installing PHP extensions are simple with the following syntax.

sudo apt install php8.0-extension_name

Now, install some commonly used php-extensions with the following command.

sudo apt install php8.0-common php8.0-mysql php8.0-xml php8.0-curl php8.0-gd php8.0-imagick php8.0-cli php8.0-dev php8.0-imap php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip -y

--

--