My case was a little different. I upgraded from Ubuntu 19.04 to 19.10. While upgration it installed php 7.3 (where as php 7.2 was already installed). With 2 versions installed a2query -m php7.3 return No module matches php7.3.
Solution I found was from how-to-install-php-7-3-on-ubuntu.
To set PHP 7.0 as the default, run
update-alternatives --set php /usr/bin/php7.0
To set PHP 7.2 as the default, run
update-alternatives --set php /usr/bin/php7.2
To set PHP 7.3 as the default, run
update-alternatives --set php /usr/bin/php7.3
Before we can configure Apache to use PHP 7.3, we need to disable the old version of PHP 7.0 by typing
Now enable the newly installed PHP 7.3 version with the following command:
Restart the Apache web server for the changes to take effect:
sudo systemctl restart apache2