How to Install PHP 8.0 on Ubuntu 20.04

This tutorial will show you how to install PHP 8.0 on Ubuntu 20.04

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

Installing PHP 8.0 with Apache

sudo apt update
sudo apt install php8.0 libapache2-mod-php8.0
sudo systemctl restart apache2

Configure Apache with PHP-FPM

sudo apt update
sudo apt install php8.0-fpm libapache2-mod-fcgid

By default PHP-FPM is not enabled in Apache. To enable it

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.0-fpm
systemctl restart apache2
systemctl status php8.0-fpm

Switch PHP versions if multiple versions installed

sudo update-alternatives --config php

Above steps should work with Nginx as well

https://www.php.net/

Share This

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*
*