I assume you're using Drupal 8 recipe and Linux as a host OS. Also, xdebug 3.x is assumed, which is standard for Lando-provided PHP image.
Example .lando.yml
file can look like this:
name: xdebug-test
recipe: drupal8
config:
webroot: web
services:
appserver:
xdebug: true
config:
php: .lando/php.ini
type: php:8.2
overrides:
environment:
PHP_IDE_CONFIG: "serverName=appserver"
Create .lando/php.ini
file like this:
[PHP]
xdebug.max_nesting_level = 256
xdebug.show_exception_trace = 0
xdebug.collect_params = 0
xdebug.mode = debug
xdebug.client_host = ${LANDO_HOST_IP}
xdebug.client_port = 9003
xdebug.start_with_request = yes
xdebug.log = /tmp/xdebug.log
Note
It looks like this is no longer needed, default php.ini
works fine now.
Standard setup should be followed (CLI interpreter setup using docker, xdebug remote port 9003. However, xdebug is not detected automatically. Fix it by running:
lando ssh -s appserver -u root
- and
find / -name '*xdebug.so'
inside of the container
It will give you a path which needs to be added to the bottom of PHPStorm CLI interpreter settings as a path to xdebug. It should be similar to: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
. Then reload found CLI interpreter and xdebug should be found.
Furthermore, in one of my projects I needed to add these settings, so that path mappings are working:
PHP > Path mappings
- /your/lando/project/path -> /app
-
- /your/lando/project/path/web -> /app/web
PHP > Servers:
Add "server" for each of your lando hostnames
Ceck "Use path mappings" and add a mapping:
/your/lando/project/path
->/app