How to Install PHP 8 on Ubuntu 22.4 using Terminal

In this tutorial, i am going to show you how to install php 8 on ubuntu 22.04 system using the terminal.

PHP is an acronym for “PHP: Hypertext Preprocessor” PHP is a widely-used, open source scripting language. PHP scripts are executed on the server. PHP is free to download and use.

How to Install PHP 8 on Ubuntu 22.04 using Terminal

Use the below given steps and install php 8 on ubuntu 22.04 using terminal:

Step 1 – Enabling PHP Repository

Run the following command on your terminal to enabling PHP repository:

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

Step 2 – Installing PHP 8.0

Run the following command on your terminal to Installing the PHP on Ubuntu 20.04:

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

By default 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 terminal to check PHP version installed on your server:

php -v

Conclusion

In this tutorial, i have shown to you how to install php 8 on ubuntu 22.04 system using the terminal.

are, use the comment form below to reach us.

Be First to Comment

Leave a Reply

Your email address will not be published.