Installing PHP 8 on Ubuntu 22.04 Example

03-Apr-2023

.

Admin

Installing PHP 8 on Ubuntu 22.04 Example

Hi Guys,

Now, let's see example of Ubuntu 20.04 on Install PHP 8. it's simple example of Step by Step Guide to Install PHP 8 on Ubuntu 20.04. I’m going to show you about How to Install PHP 8 on Ubuntu 20.04 Easily?. I explained simply about Install PHP 8 on Ubuntu: 4 Easy Steps. So, let's follow few step to create example of How to using Terminal and Install PHP 8 on Ubuntu 22.04?.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Follow the steps below and install php 8:

Step 1: Enabling PHP Repository


Type the following command to enable the PHP repository

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

Step 2: Installing PHP 8.0

Type the following command on your terminal to install

sudo apt-get update

Install The PHP 8 On Ubuntu with the below following command:

sudo apt install php8.0 libapache2-mod-php8.0

Step 3: Configure Apache with PHP-FPM

Configure Php-FPM with apache by executing the following command to install the necessary packages:

sudo apt update

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

PHP-FPM is not enabled in Apache. To enable it, run:

sudo a2enmod proxy_fcgi setenvif

sudo a2enconf php8.0-fpm

To activate the changes, restart Apache:

systemctl restart apache2

Step 4: Test Installed PHP Version

Run the following command on the terminal to check the installed PHP version:

php -v

#Ubuntu