Ok well I have spent a long time via different methods to do this.
I tried using mod_fastcgi but then went to mod_proxy_fcgi and apache 2.4. Due to the fact that so much shit breaks in 2.4 with ruby, python, perl and many other things I have got back to 2.2.
Well out of a stoke of luck from lots of googles, i found a module to allow EXACTLY what I needed. mod_fastcgi_handler.
This requires 1 line of code and will connect to PHP-FPM via either UNIX sock or TCP/IP.
My mod uses unix for efficiency. Now an example is AddHandler fcgi:/var/php/www.com.sock .php
I have debated on whether to release this or not. I thought it would be just more hassle than its worth to keep patching files…
This is technical V2 of my mod.
Now you need apache2-dev (debian-based) or http-devel (centos/redhat/fedora).
Download https://github.com/hollow/mod_fastcgi_handler and compile via instructions. Then enable in apache2.
Take the modified files from the link at the bottom and overwrite in the virtual-server module and restart webmin. These are for virtualmin 3.93.
After you need php5-fpm/php-fpm installed.
You will find a new php mode. Use it and enjoy.
To the devs, I know ALOT of ppl have asked for this and there was no good way to do it. I don’t know how this interacts with suexec, but every domain, sub-domain/sub-server has its own pool running as the user its under so permissions would apply.
I hope you add this into VM so I don’t need to keep re-hacking as this is a very good system IMHO.
Thanks for reading and I hope you enjoy my work.