Installing PHP 7 and MySQL 5.7 on Ubuntu 14.04
Often times when trying to install more up-to-date versions of software via apt, you will find that only the older versions of said software are available. This is because the apt repositories for older versions of Ubuntu are not always updated with the latest packages, so you will have to rely on PPAs (Personal Package Archives) to install newer software packages.
For PHP, the most commonly used PPA is ondrej/php, and you can add the PPA to your apt repository list like so:
sudo add-apt-repository ppa:ondrej/php sudo apt-get update
From there, you can use
apt-cache search php7.1 to find the packages that you need to install and install them.
As for MySQL, they have their own documentation for adding their repositories and installing other versions of MySQL: