In Ubuntu 18.04 How To Install PHP (7.2 / 7.3)

In Ubuntu 18.04 How To Install PHP (7.2 / 7.3)

In this tutorial, we’ll show you how to install PHP 7 on Ubuntu 18.04 Server with php 7.2 or php 7.3 .
The Hypertext Preprocessor commonly known as PHP, is a powerful, PHP is an open-source server-side scripting language which has been widely adopted for the creation of dynamic web pages. PHP is secure, fast, simple, efficient, flexible and a loosely typed scripting language.

We’ll discuss how to add the PPA on ubuntu with install  PHP 7.2 or PHP 7.3.  Before we will install PHP , We need to add PPA on Ubuntu. This article will help you to install PHP 7.3, 7.2 on Ubuntu 18.04.

Prerequisites

First install apache on ubuntu click here and read article how to install apache on ubuntu.

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

Installing the PHP on Ubuntu with PHP Version 7.2 . 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

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

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

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

Conclusion

In this article, You have learned how to install PHP 7.2 or PHP 7.3 on your Ubuntu 18.04 server with using the PPA. 

If you have any questions or thoughts to share, use the comment form below to reach us.

One reply to In Ubuntu 18.04 How To Install PHP (7.2 / 7.3)

  1. How to install DNS server on ubuntu 18.04 ?

Leave a Reply

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