apache2 – [SOLVED]How to use different versions of PHP?

With nginx, all you have to do is use sockets via proxy_pass:

server{
(...)
location ~ ^ / index  .php (/ | $) {
fastcgi_pass unix: /var/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $ directory_root $ fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $ realpath_root;
}
}

With Apache, you have to use Proxy:


     
     
     
     SetHandler "proxy: unix: /var/run/php/php7.2-fpm.sock | fcgi: // localhost /"

In this way, you can use different sockets (each for a different version of PHP) by configuring them in each virtual host.