Apache2.4 does not support mod_fastcgi, the alternate option is to run php-fpm with mod_proxy_fcgi.
On Ubuntu you need to enable mod_proxy and mod_proxy_fcgi.
a2enmod mod_proxy mod_proxy_fcgi
We can now configure apache to run php-fpm as below
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1
Here php-fpm is listening on port 9000, and it will run all file with extension .php in the DocumentRoot /var/www/html
We can also have different versions of PHP for sub-directories. For example
ProxyPassMatch ^/forum/(.*\.php)$ fcgi://127.0.0.1:9072/var/www/html/forum/$1 ProxyPassMatch ^/blog/(.*\.php)$ fcgi://127.0.0.1:9071/var/www/html/blog/$1
Above the forum sub-directory will be running with PHP 7.2 listening on port 9072 and the blog sub-directory will run PHP 7.1 listening on port 9071