How to install PHP 7.2 on Ubuntu 18.04

The following article will show you how to install PHP 7.2 on Ubuntu 18.04. In Ubuntu 18.04, PHP 7.2 is included by default in Ubuntu Repositories. The first thing we are going to do is to update our Ubuntu by using the following command

sudo apt-get update

You will be asked for your password if you are not logged in as the root user.

You can also upgrade your Ubuntu server by typing the following:

sudo apt-get upgrade

Now we can proceed with installing PHP 7.2 by typing the following command in your terminal:

sudo apt-get install php

The command will install PHP 7.2 in addition to other modules.

You can verify if PHP 7.2 has been installed by typing the following command in your terminal

php –v

Depending on how and what you’re going to use, you may need additional PHP modules and packages. You may need some add some additional packages and PHP modules in order for PHP to work with your applications. You can install the most commonly needed modules with:

apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php

Now we have installed PHP 7.2 in your Ubuntu Server.

Leave a Reply

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

Translate »