Setting sendmail_path per apache site instance and its version of PHP

For years we’ve been using this setting in each sites’ apache configuration file:

php_admin_value sendmail_path ‘/usr/sbin/sendmail -t -i -fbillingid-site1@billingid-site1.example.net

along with sendmail to relay outbound mail via local host.

I see that this particular variable has moved from apache to php-fpm www.conf file.

What I list in this post as billingid-site1 is the value to identify a site. Often we have a pair of sites for the same base domain - one for the live site eg. www.example.com and a second for staging.example.com.

Is there an approach to let me set this php variable in php-fpm per site?

For a bit more fun, I’d like to match it with the version of PHP the site uses. That is being done like this:

SetHandler “proxy:unix:/var/opt/remi/php82/run/php-fpm/www.sock|fcgi://localhost”

The most complex situation is server that hosts multiple tenants on Rocky Linux with apache and multiple versions of PHP installed.

First way is to use a different “pool” for each site with its own configuration, “www” being the default one.

Another way is to add a .user.ini file in each site top directory.

Yes you have to set the proper SetHandler for each site/app (vhost/directory) to connect to the proper FPM pool.

You can read My PHP development Workstation