Custom PHP variables in php8.3-fpm

Hi there , is there a way to add custom variables tot php-fpm such as

env[BOT_PROTECTION] = on
env[TURNSTILE_SITE_KEY] = PUBKEY
env[TURNSTILE_SECRET_KEY] = SECRETKEY
env[ALLOWED_HOSTS] = domainname.com
env[BOT_TTL] = 1800

because ading them to /etc/php/8.3/fpm/pool.d/ domainname.com they dissapear after rebuilding domain , im sorry if was already posted but i searched using google and found no info on this matter

Thanks

Create a template at the path:
/usr/local/hestia/data/templates/web/php-fpm/custom-PHP-8_3.tpl
(Note: the “custom” part can be any name you want, but “PHP-8_3.tpl” is important)

Copy the contents from:
/usr/local/hestia/data/templates/web/php-fpm/PHP-8_3.tpl
into it.

Make the necessary additions:

text

env[BOT_PROTECTION] = on
env[TURNSTILE_SITE_KEY] = PUBKEY
env[TURNSTILE_SECRET_KEY] = SECRETKEY
env[ALLOWED_HOSTS] = domainname.com
env[BOT_TTL] = 1800

Rebuild the domain, then check its functionality and the configuration changes.

Below is an example of my config:
/usr/local/hestia/data/templates/web/php-fpm/custom-Joomla-PHP-8_4.tpl

; origin-src: deb/php-fpm/multiphp.tpl
;#=========================================================================#
;# Custom Joomla PHP-FPM Template #
;# Based on Default Web Domain Template #
;# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
;# Web Templates and FastCGI/Proxy Cache | Hestia Control Panel #
;#=========================================================================#

[%domain%]
listen = /run/php/php%backend_version%-fpm-%domain%.sock
listen.owner = %user%
listen.group = www-data
listen.mode = 0660
listen.backlog = 1024

user = %user%
group = %user%

pm = dynamic
pm.max_children = 8
pm.start_servers = 4
pm.min_spare_servers = 3
pm.max_spare_servers = 7
pm.max_requests = 3000
pm.status_path = /status

request_terminate_timeout = 180s
request_slowlog_timeout = 10s
slowlog = /var/log/php-fpm/$pool-slow.log
catch_workers_output = yes

php_admin_value[upload_tmp_dir] = /home/%user%/tmp
php_admin_value[session.save_path] = /home/%user%/tmp
php_admin_value[open_basedir] = /home/%user%/.composer:/home/%user%/web/%domain%/public_html:/home/%user%/web/%domain%/private:/home/%user%/web/%domain%/public_shtml:/home/%user%/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f admin@%domain%

env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /home/%user%/tmp
env[TMPDIR] = /home/%user%/tmp
env[TEMP] = /home/%user%/tmp

Hy there thanks for answering i did custom-PHP-8_3.tpl added contents from PHP-8_3.tpl and my extra contents and v-rebuild-web-domain hestiacp_user domainname.com still doesnt work after removing contents from /etc/php/8.3/fpm/pool.d/ domainname.com :frowning:

Did you select the custom template in the domain settings? You shouldn’t touch /etc/php/8.3/fpm/pool.d/domainname.com — all the data there is generated automatically from the template after the rebuild.

Yes i did select it now the custom-PHP-8_3.tpl

but

[Tue Nov 10 10:38:29.245300 2026] [proxy_fcgi:error] [pid 178345:tid 178359] [client 79.115.20.40:0] AH01079: failed to make connection to backend: localhost
[Tue Nov 10 10:38:30.533042 2026] [proxy:error] [pid 178345:tid 178362] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.3-fpm-dark-arena.com.sock\r (localhost:8000) failed
[Tue Nov 10 10:38:30.533075 2026] [proxy_fcgi:error] [pid 178345:tid 178362] [client 79.115.20.40:0] AH01079: failed to make connection to backend: localhost
[Tue Nov 10 10:38:31.029612 2026] [proxy:error] [pid 178344:tid 178347] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.3-fpm-dark-arena.com.sock\r (localhost:8000) failed
[Tue Nov 10 10:38:31.029671 2026] [proxy_fcgi:error] [pid 178344:tid 178347] [client 79.115.20.40:0] AH01079: failed to make connection to backend: localhost
[Tue Nov 10 10:38:31.538674 2026] [proxy:error] [pid 178345:tid 178366] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.3-fpm-dark-arena.com.sock\r (localhost:8000) failed
[Tue Nov 10 10:38:31.538702 2026] [proxy_fcgi:error] [pid 178345:tid 178366] [client 79.115.20.40:0] AH01079: failed to make connection to backend: localhost
[Tue Nov 10 10:38:36.550150 2026] [proxy:error] [pid 178345:tid 178371] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.3-fpm-dark-arena.com.sock\r (localhost:8000) failed
[Tue Nov 10 10:38:36.550187 2026] [proxy_fcgi:error] [pid 178345:tid 178371] [client 79.115.20.40:0] AH01079: failed to make connection to backend: localhost

What is the exact name of the template you created?

custom-PHP-8_3.tpl

yes and selected it attempting to connect to php8.3-fpm-dark-arena.com.sock errror but file is there

HestiaCP as a verry good web hosting should at least have the option to disable auto rebuild it’s not fair for most of custom owners to force in such things , everyone who disables it should already know what they are doing :frowning:

  1. Replace the entire contents of the custom template with the contents from the original file:
    /usr/local/hestia/data/templates/web/php-fpm/PHP-8_3.tpl

  2. Rebuild the domain.

  3. Check it.

Everything should work!
Going forward, make changes one by one to see what is causing the error.

Solved thanks !

Using default editor to create file custom-PHP-8_3.tpl trows that error but after using “/usr/local/hestia/data/templates/web/php-fpm# cp PHP-8_3.tpl custom-PHP-8_3.tpl” worked !

Thanks