Install PHP on Ubuntu 18.04

PHP is one of the most popular programming language currently in the world. PHP has different versions 5.6, 7.0, 7.1 and 7.2. Ubuntu 18.04 ships with default PHP 7.2 support, We can easily install PHP 7.2 on Ubuntu. Ubuntu 18.04 is the current latest version of Ubuntu. This tutorial outlines how to install PHP 7.2 on Ubuntu 18.04.


Prerequisites

Before you start installing PHP on Ubuntu 18.04. You must have a non-root user account on your server with sudo privileges.


How to Install PHP 7.0 on Ubuntu 18.04

Update the apt package manager index typing following command:

sudo apt update

Run the following command to install PHP on your server. The following command will install php7.2.

sudo apt install php7.0

Check PHP version and confirm the installation by running following command

php -v

Following are some basic PHP extensions needs to be installed on your server

sudo apt install php7.0-curl php7.0-mysql php7.0-common php7.0-cli php7.0-gd php7.0-opcache

How to Install PHP 7.2 on Ubuntu 18.04

Update the apt package manager index typing following command:

sudo apt update

Run the following command to install PHP on your server. The following command will install php7.2.

sudo apt install php7.2

Check PHP version and confirm the installation by running following command


php -v

Following are some basic PHP extensions needs to be installed on your server

sudo apt install php7.2-curl php7.2-mysql php7.2-common php7.2-cli php7.2-gd php7.2-opcache

Conclusion

In this tutorial, you have learned how to install PHP on Ubuntu 18.04 successfully with some of its basic extensions useful for frameworks and tested successfully. If you have any of the queries regarding this then you can comment below.

#php #ubuntu

9.95 GEEK