How To Install PHP In Ubuntu 22.04?

Jul 18, 2022 . Admin

Hi Guys

This article will provide example of How To Install PHP In Ubuntu 22.04?. this example will help you Install PHP 8 on Ubuntu 22.04. We will use Install the latest PHP on Ubuntu 22.04. We will look at example of Do I Install PHP 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.

We’ll discuss how to add the PPA on ubuntu with install PHP 7.2 or PHP 7.3.

Step 1: Install PHP 7.2

Before install PHP, We’ll add the PPA For PHP 7.2

sudo apt-get install python-software-properties -y 
 
sudo add-apt-repository ppa:ondrej/php 

First update the apt package :

sudo apt-get update

Install The PHP 7.2 On Ubuntu with the below command :

sudo apt-get install php7.2
Step 2: Test Installed PHP Version

Use the below command to check the PHP version installed on your server :

php -v

Install PHP 7.2 Extensions

sudo apt-get install php7.2-<extension-name>

See example below

sudo apt-get install php7.2-fpm  php7.2-curl php7.2-mysql \ php7.2-xml php7.2-zip php7.2-gd
Step 3: Install PHP 7.3

Before install PHP 7.3, We’ll add the PPA For PHP 7.3

sudo apt-get install python-software-properties -y  

sudo add-apt-repository ppa:ondrej/php 

Installing the PHP on Ubuntu with PHP Version 7.3. First update the apt package :

sudo apt-get update

Install The PHP On Ubuntu with the below command :

sudo apt-get install php7.3
Step 4: Test Installed PHP Version

Use the below command to check the PHP version installed on your server :

php -v

Install PHP 7.3 Extensions

sudo apt-get install php7.3-<extension-name>

See example below

sudo apt-get install php7.3-fpm  php7.3-curl php7.3-mysql \ php7.3-xml php7.3-zip php7.3-gd
#Ubuntu