WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

Setting up lando with phpstorm and xdebug

Submitted by barnettech on Fri, 07/26/2024 - 21:40

Once you put in the xdebug on and off into .lando.yml you can use the path mappings in the attached screenshot to get the debugger working in phpstorm. I needed to setup these pathmappings to get it working.

excerpt from my working .lando.yml

tooling:
  xdebug-on:
    service: appserver
    description: Enable Xdebug.
    user: root
    cmd:
      - docker-php-ext-enable xdebug && kill -USR2 $(pgrep -o php-fpm) > /dev/null || /etc/init.d/apache2 reload
      - tput setaf 2 && echo "Xdebug On" && tput sgr 0 && echo

    xdebug-off:
      service: appserver
      description: Disable Xdebug.
      user: root
      cmd:
        - rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && kill -USR2 $(pgrep -o php-fpm) > /dev/null || /etc/init.d/apache2 reload
        - tput setaf 1 && echo "Xdebug Off" && tput sgr 0 && echo
PHPSTORM PathMappings