Is it possible to set up PHP-FPM with different pool-options (xdebug enabled / xdebug disabled)

php-fpmpoolxdebug

I've a LEMP environment and need the option to separate all development subdomains from staging (development with xdebug staging without).

  • dev.projectX.mydomain.tld
  • staging.projectX.mydomain.tld

Therefore I set up two pools php-dev and php-stage, but it seems that i can enable extensions only in the php.ini!?

Here is my pool.conf (dev)

[php-dev]
listen = 127.0.0.1:9101
listen = /var/run/php-fpm/a1-php-dev.socket
listen.backlog = -1
listen.allowed_clients = 127.0.0.1

user = nginx
group = nginx

request_slowlog_timeout = 3s
slowlog = /var/log/php-fpm/slowlog-php-dev.log

pm = dynamic
pm.max_children = 20
pm.start_servers = 10
pm.min_spare_servers = 4
pm.max_spare_servers = 16
pm.max_requests = 500
pm.status_path = /status

request_terminate_timeout = 120s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

php_admin_value[zend_extension]         = "/usr/lib64/php/modules/xdebug.so"
php_admin_value[xdebug.default_enable]      = 0
php_admin_value[xdebug.remote_enable]       = 0
php_admin_value[xdebug.remote_autostart]        = 0
php_admin_value[xdebug.remote_host]         = localhost 
php_admin_value[xdebug.profiler_enable_trigger]     = 0
php_admin_value[xdebug.remote_port]         = 9001
php_admin_value[xdebug.collect_params]      = 2
php_admin_value[xdebug.collect_vars]        = 1
php_admin_value[xdebug.trace_format]        = 2

Unfortunately, xdebug won't be loaded.

Is there any other option to load xdebug only on dev.* domains?

Best Answer

Unfortunately you can't load different modules or version of modules for each FPM pool. So far I've created multiple completely separate instances of PHP-FPM in similar situations.

Related Topic