A community of developers


How To Install PHP 7.4 on Ubuntu 19.04/18.04/16.04

install php 7.4 on Ubuntu 19.08

In this step by step tutorial, we’ll learn to install PHP 7.4 on our Ubuntu 19.04 or also on Ubuntu 18.04 or Ubuntu 16.04.

PHP 7.4 has been released in November 2019 with many new features such as arrow functions and the spread operator in arrays plus the increased performance and reduced memory usage.

PHP is the most popular server-side programming language for building web applications and sites. It’s the base of WordPress, which is the most popular content management system in the world. Let’s see how to install it on our Ubuntu 19.04 system step by step.

Step 1: Adding a PHP PPA Repository

Since Ubuntu 19.04 and previous versions don’t include PHP 7.4 in the official repositories, we need to use a PPA. Let’s add ppa:ondrej/php repository which provides the latest packages of PHP.

Open your terminal and run the following commands:

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

Step 2: Installing PHP 7.4 on Ubuntu 19.04/18.04

After adding the PPA with the latest PHP 7.4 version, we can now install PHP 7.4 on our Ubuntu 19.04/18.04 system using the following command:

sudo apt -y install php7.4

Next, we can ensure we have successfully installed the latest version using the following command:

$ php -v
PHP 7.4.4 (cli) (built: Mar 20 2020 13:47:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.4, Copyright (c), by Zend Technologies

Next, you can install the additional modules required by PHP using the following command:

sudo apt-get install -y php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip}

Leave a Reply

Skip to toolbar