Skip to content

Instantly share code, notes, and snippets.

@dkjensen
Created October 30, 2023 19:48
Show Gist options
  • Save dkjensen/76110842adadd2dadbc07a1c976dfd38 to your computer and use it in GitHub Desktop.
Save dkjensen/76110842adadd2dadbc07a1c976dfd38 to your computer and use it in GitHub Desktop.
Lando + XDebug + VSCode + WordPress
name: sandbox.local
recipe: wordpress
config:
php: 8.2
webroot: www
services:
database:
type: mariadb
appserver:
xdebug: true
config:
php: .lando/php.ini
overrides:
environment:
XDEBUG_MODE:
LANDO_HOST_IP: "host.docker.internal"
XDEBUG_CONFIG: "client_host=host.docker.internal client_port=9003 start_with_request=yes profiler_output_dir=/tmp"
run_as_root:
- "apt-get update -y"
- "apt-get install nano -y"
mailhog:
type: mailhog
hogfrom:
- appserver
tooling:
xdebug:
description: Loads Xdebug in the selected mode.
cmd:
- appserver: /app/.lando/xdebug.sh
user: root
xdebug.max_nesting_level = 256
xdebug.show_exception_trace = 0
xdebug.client_host = ${LANDO_HOST_IP}
xdebug.log = /app/xdebug.log
xdebug.output_dir = /app/profiles
xdebug.mode = debug
xdebug.client_port = 9003
xdebug.start_with_request = yes
xdebug.discover_client_host = true
xdebug.profiler_output_dir = /app/profiles
xdebug.remote_enable=true
xdebug.remote_autostart=true
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Xdebug has been turned off, please use the following syntax: 'lando xdebug <mode>'."
echo "Valid modes: https://xdebug.org/docs/all_settings#mode."
echo xdebug.mode = off > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini
pkill -o -USR2 php-fpm
else
mode="$1"
echo xdebug.mode = "$mode" > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini
pkill -o -USR2 php-fpm
echo "Xdebug is loaded in "$mode" mode."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment