Установка PHP 5.6 7.0 7.1 7.2 7.3 на UBUNTU 18

  Web серверы

Все базовые версии PHP можно установить из репозитория ppa:ondrej/php

Для этого:

apt-get install python-software-properties
add-apt-repository ppa:ondrej/php
apt-get update
Далее устанавливаем то, что нам нужно одной из команд:
apt-get install php5.6
apt-get install php7.0
apt-get install php7.1
apt-get install php7.2
apt-get install php7.3
Чтобы поставить модули PHP, рекомендую посмотреть что есть:
apt list php7.1*

Видим примерно следущее:

Listing… Done
php7.1/bionic,bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 all
php7.1-bcmath/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-bz2/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-cgi/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-cli/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-common/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-curl/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-dba/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-dev/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-enchant/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-fpm/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-gd/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-gmp/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-imap/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-interbase/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-intl/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-json/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-ldap/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-mapi/bionic,bionic,bionic,bionic 8.5.5-0ubuntu1 all
php7.1-mbstring/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-mcrypt/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-mysql/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-odbc/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-opcache/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-pgsql/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-phpdbg/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-pspell/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-readline/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-recode/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-snmp/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-soap/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-sqlite3/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-sybase/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-tidy/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-xml/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-xmlrpc/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64
php7.1-xsl/bionic,bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 all
php7.1-zip/bionic 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64

И выбираем что нам нужно:

apt-get install php7.1-curl php7.1-gd php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-soap php7.1-tidy php7.1-xml php7.1-xsl