install php with version in ubuntu code example
Example 1: change php version ubuntu
$ sudo update-alternatives --config php
or
$ sudo a2enmod php7.1(version)
Example 2: ubuntu install php
apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php