sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mysql php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-gd php7.2-xml php7.2-cli php7.2-zip
sudo cp /etc/php/7.0/apache2/php.ini /etc/php/7.2/apache2/php.ini
sudo systemctl restart apache2.service
sudo a2enmod php7.2
sudo a2dismod php7.1
sudo systemctl restart apache2.service