Multiple php versions per directory on CentOS 7

on Apache 2.4.6 original Virtualmin version for CentOS 7 i was able to run different php versions per directory…
inspired by

Then, I updated Apache to 2.4.41 for HTTP2 support, now that doesn’t work anymore
and I can’t use (example) php 5.6 together with 7.2 by that method.

I get errors like

[Tue Jun 30 21:41:21.178328 2020] [fcgid:warn] [pid 21288:tid 140179729569536] (104)Connection reset by peer: [client] mod_fcgid: error reading data from FastCGI server
[Tue Jun 30 21:41:21.178355 2020] [core:error] [pid 21288:tid 140179729569536] [client] End of script output before headers: index.php

Why, please?

I tried to

<IfModule mod_proxy_fcgi.c>
<FilesMatch .php$>
SetHandler “proxy:fcgi://”
AddHandler php56-fcgi .php
Action php56-fcgi /home/myuser/fcgi-bin/php56.fcgi

instead of

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
AddHandler fcgid-script .php5.6
FCGIWrapper /home/myuser/fcgi-bin/php56.fcgi .php
FCGIWrapper /home/myuser/fcgi-bin/php56.fcgi .php5
FCGIWrapper /home/myuser/fcgi-bin/php56.fcgi .php5.6

but I get the error page enabled by ProxyErrorOverride

Can you help, please? Thank you very much

initially it seemed a suexec issue for docroot but then I recompiled suexec with the correct /home, so it’s not the issue, I also tried to disable opcache for php 5.6 and not even that. Error logs don’t contain anything to start. It’s really weird at the moment.
From command line, by

php56 phpinfo.php


php56 index.php

I can regularly see the file content, so it’s just a web issue to solve.

I’m thinking of an issue with the latest virtualmin versions rather than httpd because I remember that I tested the websites after the httpd replacement. So, it could be something you did related to php fpm which prevents php fpm to work together fcgid into another directory even if

ProxyPass /mydir !

before the ProxyPassMatch directive
So, please, I need help about this. Thanks

Well, it seems the issue was from

ProxyErrorOverride On

together with expires and deflate rules at server config level instead of inside a directory…and the ProxyPass “cache” (now set to retry=0), but that’s really weird because never done before…I will check this behavior over time