Setting up XDebug on Local

Take your PHP code debugging skills to the next level using XDebug with VS Code when you use Local (by Flywheel) as your server stack.

Stop using echo and var_dump commands to see what’s going on, use the professional tools available to you.

When using PHP 8+ for your website ( typically a WordPress site) on Local by FlyWheel you will need to tweak some settings to start live debugging.

Step 1 – Edit PHP.ini

Locate and update your PHP Ini file

Using File Manager/Finder locate the init file, php.ini.hbs file. Open it in VS Code.

Scroll to the bottom of the file and make sure the contents are like:

{{#if os.windows}}
zend_extension = php_xdebug.dll
zend_extension = {{extensionsDir}}/xdebug.so

{{#if xdebugEnabled}}

xdebug.start_with_request = yes
xdebug.idekey = VSCODE

Save and restart your server in Local.

Step 2 – Create a debug Configuration file in VS Code

Make sure the PHP Debug Extension is installed and Active.

In VS Code ensure the Debug Extension is selected ,then choose Add Config

This will open launch.json. Make sure it looks like this:-

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
            "name": "Listen for Xdebug 3.0 (Local)",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "stopOnEntry": false,
            "xdebugSettings": {
                "max_children": 128,
                "max_data": 1024,
                "max_depth": 3,
                "show_hidden": 1

Now you’re all set to start debugging your code.

My code snippets

To save you time copying and pasting the code above over and over again for each site you want to debug, please feel free to add the following code to your Code Snippets in VS Code.

Here is my xdebug.code-snippets file:

	"XDEBUG": {
		"prefix": "xdebug",
		"body": [
			"xdebug.start_with_request = yes",
			"xdebug.idekey = VSCODE"
		"description": "Write V3 XDEBUG to PHP Ini file"
	"Debug config": {
		"prefix": "debug",
		"body": [
			"\"name\": \"Listen for Xdebug 3.0 (Local)\",",
			"\"type\": \"php\",",
			"\"request\": \"launch\",",
			"\"port\": 9003,",
			"\"stopOnEntry\": false,",
			"\"xdebugSettings\": {",
			"\"max_children\": 128,",
			"\"max_data\": 1024,",
			"\"max_depth\": 3,",
			"\"show_hidden\": 1",
		"description": "Debug configuration"

Then you can easily add the necessary code you your PHP.ini file and your debug configuration setting file.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.