8

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?

6

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.

1

Yes, but the extra pool also needs to run under a separate service. That service can use the same binaries, but needs its own conf files and (some) dirs. How to achieve this depends on your system and its service manager. I used this answer as a basis because I have systemd.

0

simplest is to create service in /etc/init/php-xdebug

start on runlevel [2345]
stop on runlevel [016]

# you can uncomment this with recent upstart
# reload signal USR2

pre-start script
mkdir -p /run/php
chmod 0755 /run/php
chown www-data:www-data /run/php
end script

respawn
exec /usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-xdebug.conf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.