Skip to main content

How to install PHP on Ubuntu 16.04

Below are the steps to install PHP 7.2 and its related most important modules. Currently as of now PHP 7.2 is the latest stable version and we recommend you to install this.

Step 1: As always first update Ubuntu

sudo apt-get update && apt-get upgrade

Step 2: To add PHP repository you need to first install this

sudo apt-get install python-software-properties

Step 3: Add PHP repository from ondrej

sudo add-apt-repository ppa:ondrej/php

Step 4: Update your package list

sudo apt-get update

Step 5: Install PHP 7.2

sudo apt-get install php7.2

Step 6: Verify PHP 7.2 installed Successfully

php -v

Step 7: Install Related and important PHP modules

sudo apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
Tags
Submitted by tgoswami on September 10, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.