Simple and light way to install the PHP 8 to Ubuntu 20.04.
Step 1: Enabling PHP Repository
Ondřej Surý, a Debian developer, maintains a repository that includes multiple PHP versions. To enable the repository , run:
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
Once the PPA is enabled, you can install PHP 8.
Step 2a: Install PHP 8.0 with Apache
sudo apt update
sudo apt install php8.0 libapache2-mod-php8.0
Once the packages are installed, we need to restart the Apache services.
sudo systemctl restart apache2
Step 2b: Install PHP 8.0 with Nginx
Nginx doesn’t have built-in support for processing PHP files. We’ll use PHP-FPM (“fastCGI process manager”) to handle the PHP files.
sudo apt update
sudo apt install php8.0-fpm
Once the installation is completed, the FPM service will start automatically. To check the status of the service, run
systemctl status php8.0-fpm
Output:
php8.0-fpm.service - The PHP 8.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.0-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-12-03 16:10:47 UTC; 6s ago
You can restart you Nginx serve with the command:
sudo systemctl restart nginx
Pingback: Apache Web Server - Learn with Arctic Guru