This assumes you are using a Drupal 8 or Drupal 9 recipe and Mac 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:7.4
overrides:
environment:
PHP_IDE_CONFIG: "serverName=appserver"
and .lando/php.ini
file like this:
[PHP]
memory_limit = -1
max_execution_time = 90
post_max_size = 100M
upload_max_filesize = 100M
[Xdebug]
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
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
- Include paths:
/home/<user>/.lando/config/drupal8
PHP > Servers: - check "Use path mappings" and add these mappings:
<local/project/path>
->/app
web
->/app/web
Yea, hopefully someone who encounters that issue finds this thread! :)