This post explain how to upgrade to PHP 7.3 in a Virtual Machine (VM) on the Google Cloud Platform (GCP).

The php version can be checked using

php -v

1.- go to the console on the GCP. Open a terminal using SSH

2.-In the terminal

sudo apt-get install ca-certificates apt-transport-https 

wget -q -O- | sudo apt-key add -
echo "deb stretch main" | sudo tee /etc/apt/sources.list.d/php.list

sudo apt-get update

sudo apt-get install php7.3

3.- After executing the download and installation, disable the old one and enable the new PHP

sudo a2dismod php7.0
sudo a2enmod php7.3

If there is a mysql error like

Your PHP installation appears to be missing the MySQL extension which is required by WordPress

It can be fixed reinstalling the PHP plugin, accorded to the version

sudo apt-get install php7.3-mysql

4.- Restart the server

sudo systemctl restart apache2

5.- check the version using this plugin: