Enable xdebug on wordpress-develop repo

·

Just adding this for my future self’s health. First, update the PHP config file.

// Enable xdebug.

...
xdebug.mode=develop,debug
...

The VSCode launch file:

{
    "version": "0.2.0",
    "configurations": [
		{
			"name": "Listen for XDebug",
			"type": "php",
			"request": "launch",
			"port": 9003,
			"pathMappings": {
				"/var/www": "${workspaceFolder}",
			},
		},
    ]
}

Do not forget to update your .env file.

...

# Where to run WordPress from. Valid options are 'src' and 'build'.
LOCAL_DIR=src

# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
LOCAL_PHP=latest

# Whether or not to enable Xdebug.
LOCAL_PHP_XDEBUG=true

...

Beware of trying to make it work with AI; you may end up with some hallucinations and tons of files!

Screenshot of a code editor displaying a file tree with nine changed files, including php-config-enhanced.ini, launch.json, and xdebug-test.php.
AI generated and updated files, that are not needed in my case.

Leave a Reply

Discover more from Carlos Bravo

Subscribe now to keep reading and get access to the full archive.

Continue reading