I did this and it is working on a Raspberry Pi 3+
INSTALLING PHP7-MARIADB-APACHE2 ( L inux A pache M ySQL P HP)
sudo apt-get update
sudo apt-get install apache2 mariadb-server
At the installation of the MySQL/MariaDB server, you will be prompted to create a root password. Be sure to remember your password as you will need it during Nextcloud database setup.
sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb Index of /php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt-get install php7.3 php7.3-cli php7.3-common php7.3-mysql php7.3-fpm php7.3-curl php7.3-opcache libapache2-mod-php7.3 php7.3-mbstring php7.3-xml php7.3-gd php7.3-imagick php7.3-recode php7.3-tidy php7.3-xmlrpc php7.3-bz2 php7.3-intl php7.3-json php7.0-mbstring php7.3-imap php7.3-pspell php7.3-xsl php7.3-zip php-memcache php-redis php7.0-mcrypt php-pear php-zip
sudo a2dismod php7.0
sudo a2enmod php7.3
sudo service apache2 restart
php -version
sudo update-alternatives --config php
mysql --version
sudo systemctl start apache2
sudo systemctl enable apache2