Features · Xdebug
Per-site Xdebug on Mac.
Bothy is a native Mac app for local PHP development. Xdebug is a switch on each site: turn it on for the site you're debugging, and every other site keeps running without it.
Why per-site rather than always on
Xdebug is the most useful tool in PHP and also the most expensive to leave loaded. With step debugging enabled, every request pays for it, and a page that renders in 80ms can take noticeably longer. Leave it on globally and your whole local setup feels slow; turn it off globally and you're editing ini files and restarting PHP every time you want a breakpoint.
Bothy runs each site in its own php-fpm pool (see multiple PHP versions), which means Xdebug can be switched on for one site's pool without touching the others. The site you're debugging gets Xdebug; the rest don't notice.
Turning it on
From the site's page in the app, or:
bothy site xdebug shop on # …debug… bothy site xdebug shop off
Also available to AI assistants as the bothy_set_site_xdebug MCP tool.
What Bothy sets up
- Installed on first use. The first time you enable Xdebug on a site, Bothy installs it for that site's PHP version. Nothing to
pecl install. - Port 9003 on 127.0.0.1. This is Xdebug 3's default, and what current PhpStorm and VS Code expect, so IDE defaults usually just work. (Xdebug 2 used 9000, which clashed with php-fpm's traditional port; if an old tutorial says 9000, that's why.)
debug,developmode.debugis step debugging.developadds Xdebug's development helpers: more readablevar_dump()output and stack traces on errors and warnings.
Files are served straight from your folders on your Mac, so the paths PHP reports are the paths your IDE has open. There are no path mappings to maintain, unlike debugging into a container or VM.
PhpStorm setup
- In Settings → PHP → Debug, check the Xdebug port is
9003(the default in current versions). - Click Start Listening for PHP Debug Connections (the telephone icon in the toolbar).
- Set a breakpoint and load the page at
https://shop.test. On the first connection PhpStorm offers to create a server entry forshop.test; accept it. Because files are local, no path mappings are needed.
PhpStorm's general Xdebug documentation covers the rest; the Xdebug on Mac guide goes into more detail.
VS Code setup
- Install the PHP Debug extension (by Xdebug).
- Add a launch configuration that listens on 9003. The extension's generated
launch.jsonincludes one called Listen for Xdebug:{ "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9003 } - Start that configuration, set a breakpoint and load the site. Open the site's folder as the workspace so paths match without any
pathMappings.
Cursor, Windsurf and other VS Code forks use the same extension.
If the debugger doesn't stop
- Is Xdebug on for this site? The toggle is per site, so check it's the site you're loading, not a sibling on the same PHP version.
- Is the IDE listening on 9003? Only one program can listen on that port; two IDEs open at once will fight over it.
- No trigger needed. Bothy sets
xdebug.start_with_request=yes, so with Xdebug on for a site every request starts a session. If nothing arrives, the IDE isn't listening on 9003 or the path mappings are wrong. - Check the PHP log for Xdebug's own connection messages:
bothy logs shop --kind php.
Questions
9003 on 127.0.0.1, Xdebug 3's default. Set your IDE to listen on 9003.
No. Bothy installs it for a PHP version the first time you enable it on a site that uses that version.
No. Each site has its own php-fpm pool and Xdebug is switched on per site, so other sites run without it.
Not usually. Sites are served from folders on your Mac, so the file paths PHP reports match the ones in your IDE.
debug,develop: step debugging plus Xdebug's development helpers such as improved var_dump() output.