How to install PHP 7.3 7.2 and 7.0 on Ubuntu 18.04

Time:2020-3-22

PHP 7.3 is the latest version of PHP. If you want to install the specified version of PHP, this article will help you a lot. This article will help you install PHP 7.3 7.2 and 7.0 via PPA on Ubuntu 18.04, 16.04.

Install PHP 7.3

Install PHP 7.3 with the following command


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

After installation, check the PHP version with the following command


$ php -v 
PHP 7.3.3-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:31:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
 with Zend OPcache v7.3.3-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Install PHP 7.2

Install PHP 7.2 with the following command


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

After installation, check the PHP version with the following command


$ php -v 
PHP 7.2.16-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:23:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
 with Zend OPcache v7.2.16-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Install PHP 7.1

Install PHP 7.1 with the following command


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

After installation, check the PHP version with the following command


$ php -v 
PHP 7.1.27-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:02:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
 with Zend OPcache v7.1.27-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Install PHP 7.0

Install PHP 7.0 with the following command


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

After installation, check the PHP version with the following command


$ php -v 
PHP 7.0.33-5+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Mar 8 2019 09:49:15) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
  with Zend OPcache v7.0.33-5+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies

Install PHP 7 module

Use the following command to install the PHP 7 module


$ sudo apt-cache search php7*

php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
...
...
...
php7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.1-xmlrpc - XMLRPC-EPI module for PHP
php7.1-zip - Zip module for PHP
php7.1-opcache - Zend OpCache module for PHP
php7.1 - server-side, HTML-embedded scripting language (metapackage)
php7.1-xsl - XSL module for PHP (dummy)
...
...
php7.2-bcmath - Bcmath module for PHP
php7.2-bz2 - bzip2 module for PHP
php7.2-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.2-cli - command-line interpreter for the PHP scripting language
php7.2-common - documentation, examples and common module for PHP
php7.2-curl - CURL module for PHP
php7.2-dba - DBA module for PHP

Use the following command to install the PHP extension module as required. Before installing, make sure to install the correct version of PHP.

$ sudo apt-get install php7.2-mysql php7.2-curl php7.2-json php7.2-cgi php7.2-xsl

After the installation is complete, you can start PHP development now.

summary

The above is the method that Xiaobian introduced to you to install PHP 7.3 7.2 and 7.0 on Ubuntu 18.04. I hope it can help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time!

Recommended Today

Hadoop introduction

1. Brief development Hadoop includes HDFS (for distributed storage) and map reduce (for Parallel Computing). Hadoop is mainly divided into two major versions, 1.0 and 2.0 1 version Map reduce is not only responsible for parallel computing, but also used to integrate underlying CPU, memory and other resources, and allocate computing content to these resources. […]