Lando tips and issues (how to fix those)

There are commands that wil fix the problem, like so:

$ lando poweroff
$ lando start
$ lando rebuild -y

But there will be some cases that running those commands won’t fix the problem. What you need to do:

$ lando poweroff
$ docker rm 64451b59f5ef # the container id of the traefik container to be removed.
$ docker network prune # will remove all network created.
# use with caution it will provide some side effects on other projects networks.
# if you run this command is best to remove the .lando directory from you home dir.
$ docker destroy -y # will remove all containers related to the project.
# create an database backup first, you will loose all data.
$ rm -Rf ~/.lando # erase all plugins and configuration from lando config directory.
# sometimes will fix the problem for you. don't forget to run the lando poweroff first.
$ docker system prune -a # will erase all containers, images, networks from the whole system, will be the last option for you.
# if you are runnung docker desktop on MacOSX with Apple Silicon processor (M1 and M2) that will be the only option you have to fix some issues.

XDebug is the most essential PHP tool for developers

I can’t live without Lando, so this will be the step-by-step tutorial to set everything in lando to debug an app with XDebug

First thing first, adjust the .lando.yml file:

name: drupal-module-development-book
recipe: drupal10
  webroot: web
  php: 8.1
  database: mariadb
  xdebug: true
    php: scripts/php.ini

        - "host.docker.internal:host-gateway"

Now you have to create the php.ini file inside scripts’ directory on top of the root project’s directory:

memory_limit = -1


OK, almost finished. We’ve set the container gateway (docker) to access our host ip address and also set the client’s port to be listen on 9003 (XDebug > 3) with the PHPSTORM idekey (change if need it). Now install the browser extension called Xdebug helper click here, I’m a Firefox user, so if you are a Chrome user, search on the web and you will find it. The last is to set up your IDE (Integrated Development Environment) or Text Editor to run the debugger. Here is a screenshot example using the PhpStorm IDE. Go to Main Menu -> Run -> Edit Configurations…

Run/Debug Configurations window on PhpStorm IDE

And that is it! Happy hacking!