Guides & Comparisons• 3 min read
Setup Xdebug in Cursor, VS Code & PhpStorm on macOS (Port 9003)
Configure 1-click Xdebug 3 step-debugging in Stratos for Cursor, VS Code, and PhpStorm with exact php.ini directives and launch.json.
1-Click Xdebug 3 Setup on Native macOS PHP
Unlike Docker setups where client_host must point to host.docker.internal and complex pathMappings break breakpoints, Stratos runs PHP natively on macOS. Breakpoints map directly to your local filesystem paths on 127.0.0.1:9003.
Step 1: Enable Xdebug in Stratos
- Open Stratos → Settings → PHP Extensions.
- Toggle Xdebug ON for your active PHP version (
8.1–8.5). - Stratos automatically writes the Xdebug 3 directives and restarts the corresponding PHP-FPM pool:
zend_extension=xdebug.so
xdebug.mode=develop,debug
xdebug.start_with_request=yes
xdebug.client_port=9003
xdebug.client_host=127.0.0.1
xdebug.idekey=PHPSTORM
Step 2: Configure Cursor or VS Code
- Install the PHP Debug extension (
xdebug.php-debug) from the Extensions marketplace in Cursor or VS Code. - Create or update
.vscode/launch.jsonin your project root:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug (Stratos 9003)",
"type": "php",
"request": "launch",
"port": 9003,
"hostname": "127.0.0.1"
}
]
}
Press F5 in Cursor or VS Code, set a breakpoint in a Laravel controller or route, and reload https://your-app.test.
Step 3: Configure PhpStorm
- Go to Settings → PHP → Debug and verify Xdebug port is
9003and Can accept external connections is checked. - Click the Start Listening for PHP Debug Connections telephone icon in the PhpStorm toolbar.
- Reload your
.testsite—PhpStorm catches the request automatically withidekey=PHPSTORM.
Troubleshooting Breakpoints Not Hitting
- Confirm another process (like Docker/PHP-FPM leftover) is not bound to port
9003withlsof -i :9003. - For performance-sensitive runs when not debugging, toggle Xdebug OFF in Stratos or use the built-in SPX Profiler (
?SPX_KEY=dev&SPX_UI_URI=/) for CPU and memory flame graphs with near-zero idle overhead.
Full Xdebug & SPX Reference → Pair with Cursor Local AI MCP →