drubb
1/8/2020 - 5:49 PM

Switch Xdebug on / off dynamically in Lando

How to add custom Lando commands to switch Xdebug on / off when needed. This only works using Apache app servers!

Usage:

lando xdebug-on - enable Xdebug
lando xdebug-off - disable Xdebug

Add these lines to your Lando configuration file (.lando.yml)

tooling:
  xdebug-on:
    service: appserver
    description: Enable Xdebug
    cmd: "docker-php-ext-enable xdebug && echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && /etc/init.d/apache2 reload"
    user: root
  xdebug-off:
    service: appserver
    description: Disable Xdebug
    cmd: "rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && /etc/init.d/apache2 reload"
    user: root