After my last encounter with PHP Xdebug 2.9, I read the news in Laravel News about the release of Xdebug 3, the great new features ... and breaking changes. Almost at the same, Lando users started to report that the new builds of the docker container were coming with the new Xdebug 3. So, it's time to update my recipes for Lando - Docker containers, battle-tested for Lamp, Joomla, WordPress, PrestaShop, Laravel, etc. In the same movement, I've confirmed the required changes to make it work for Visual Studio Code and felixfbecker/vscode-php-debug.

The required php.ini configuration:


;;;;;;;;;;;;;;;;;;;
; xdebug-3.0.0
; https://xdebug.org/docs/upgrade_guide
;;;;;;;;;;;;;;;;;;;
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.discover_client_host = true
; xdebug.client_host = ${LANDO_HOST_IP}
xdebug.client_port = 9099

The required VSCode configuration:


{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            // A custom port for Xdebug
            "port": 9099,

            // server -> local
            "pathMappings": {
                "/app/www": "${workspaceRoot}/www"
            }
        }
    ]
}

That's it!

BTW: if you need to still run Xdebug 2.98 on Lando, you can force it in the recipe in this way:


build_as_root:
  # Install xdebug-2.9.8, wait until Xdebug 3 is fully tested
  - pecl uninstall xdebug
  - pecl install xdebug-2.9.8

Aníbal Sánchez - Perdido y Encontrado en la Computación

Aníbal Sánchez

Versatile Software Engineer | Full-Stack Developer (PHP, Laravel, Java, Spring, Vue.js/Vite) | Data Science Enthusiast | Open Source Contributor | Tech Entrepreneur

Bio

  • PHP-Prefixer / Product Manager
  • PHP-Prefixer is an automated online service powered by a complex rule-based system that applies prefixes to Composer dependencies.
  • Extly Tech / Team Leader
  • Empower your project with our web solutions. Today, working on Laravel, Amazon AWS, and Ionic. A Joomla Volunteer.

Follow @anibalsanchez


Aikido Manual Aetaiki - Aikikai