One of the well known problems is the $pool variable (func/domain.sh) that contans wrong path in case multiple php versions installed.
Possible concepts:
1. Along with Web Template and Backend Template (mainly unix socket vs tcp socket vs no-php) there could be third field - PHP version. It could be filled the same way as v-list-sys-services correctly lists all FPMs. This concept requires changes in backend scripts and web.
2. Lets make standard of naming backend templates in data/templates/web/php-fpm. I suggest something like PHP-8.3-socket. Then the v-change-web-domain-backend-tpl may be changed to parse the name of the template and extract the required PHP version:
Code: Select all
echo 'PHP-8.3-socket' | cut -d'-' -f2
Code: Select all
# Deleting backend
#rm -f $pool/$backend_type.conf
find /etc/php -name "$backend_type.conf" -delete
Code: Select all
# Changing backend config
cat $WEBTPL/$WEB_BACKEND/$template.tpl |\
sed -e "s|%backend_port%|$backend_port|" \
-e "s|%user%|$user|g"\
-e "s|%domain%|$domain|g"\
-e "s|%domain_idn%|$domain_idn|"\
-e "s|%backend%|$backend_type|g" > /etc/php/$phpversion/fpm/pool.d/$backend_type.conf
As for unix socket, I suggest standard naming like
to avoid collisions. And also fpm backends restart code should be revised, either restarting all of them, or only necessary versions.[%backend%]
listen = /var/run/php/83-%backend%.sock
I'm trying to make the second case on my server just now. I'm not as good in linux script coding to make it correctly handling no-php (that does not contain php version in its name) etc, but I am sure I will be able to finish it for all php unix socket templates.
P.S. unfortunately, Backend Template field has names cut before first dot, I believe there should be last dot, e.g. strrpos instead of strpos.