How to Install Multiple Versions of PHP on Ubuntu 16.04/17.10
This tutorial shows you how to install multiple versions of PHP on Ubuntu 16.04/Ubuntu 17.10 and let a particular Apache virtual host or Nginx server block use one of them. This is useful when you have multiple web applications on your server but one or two of them isn’t compatible with the PHP version in the default Ubuntu repository. Ubuntu 16.04 repository includes PHP7.0 and Ubuntu 17.10 repository includes PHP7.1. We will see how to install PHP5.6, PHP7.0, PHP7.1 and PHP7.2 on a single Ubuntu 16.04/17.10 server.
Read full tutorial here: https://www.linuxbabe.com/ubuntu/php-multiple-versions-ubuntu-16-04-17-10