Use slic xdebug status to find the configuration details for the project that you have run slic use on. This command will give you the path mappings and the port number that you need.
In PHPStorm settings:
- Search for
debug - Select
PHP>Debug - Ensure that the Debug port is set to whatever
slic xdebug statusreturns. (typically9001)
In PHPStorm settings:
- Search for
server - Select
PHP>Servers - Click the
+button to add a new server - Set the
Nametoslic - Set the
Hostto whateverslic xdebug statusreturns. (typicallyhttp://localhost:8888... yes, put the whole thing in theHostfield) - Set the
Portto80 - Check the
Use path mappingscheckbox - Find the
wp-content/pluginsdirectory and set theAbsolute path on the serverto/var/www/html/wp-content/plugins - If you've added the
slicdirectory to your workspace, find theslic/_wordpressdirectory and set theAbsolute path on the serverto/var/www/html
Screenshot from PhpStorm's video:
Here's a standard configuration for Xdebug in VSCode or VSCode-like editors. (Note: Be sure to use slic xdebug status to get the correct paths and port number.)
{
"version": "0.2.0",
"configurations": [
{
"name": "Slic: Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9001,
"pathMappings": {
"/var/www/html/wp-content/plugins": "${workspaceFolder}/<PATH_TO_WP_CONTENT_DIR>/plugins",
"/var/www/html": "${workspaceFolder}/slic/_wordpress"
},
"ignore": [
"**/vendor/**/*.php"
],
"stopOnEntry": false
}
]
}In this launch.json file, there are two pathMappings entries:
- The first one maps the
slicplugins directory (left side) to your local WP's plugins directory (right side). - The second one is technically optional, but it assumes you've added the
slicdirectory to your VSCode workspace and maps theslicWP root (left side) to your localslicdirectory's WP root (right side).
When using slic on WSL2 (Windows Subsystem for Linux), the default host.docker.internal configuration may not work correctly because Docker containers need to connect to the WSL2 host where your code editor is running, not the Windows host.
Important: All commands in this section should be run in your WSL2/Ubuntu terminal, not in Windows PowerShell or Command Prompt.
First, identify your WSL2 IP address:
hostname -I | awk '{print $1}'This will output your WSL2 IP address (e.g., 172.24.206.58).
Configure slic's Xdebug to use your WSL2 IP address instead of the default host.docker.internal:
slic xdebug host $(hostname -I | awk '{print $1}')Or manually set it if you know your WSL2 IP:
slic xdebug host 172.24.206.58Note: WSL2 IP addresses can change after restarting WSL2 or Windows, though they often remain stable. If breakpoints stop working, check if your IP has changed and reconfigure if necessary (see Troubleshooting below).
After changing the Xdebug host, restart the slic containers to apply the changes:
slic restart
slic xdebug onVerify that Xdebug is configured correctly:
slic xdebug statusYou should see your WSL2 IP address in the "Remote host" field.
If breakpoints still don't work:
-
Check if your WSL2 IP changed: WSL2 IP addresses can change after restarting WSL2 or Windows (though they often remain stable). If breakpoints stop working, verify your current IP and reconfigure if it has changed:
slic xdebug host $(hostname -I | awk '{print $1}') slic restart slic xdebug onYou can verify your current WSL2 IP with:
hostname -I | awk '{print $1}'
-
Verify your editor is listening: Check your editor's debug console to see if there are any connection attempts from Xdebug. In VS Code, go to View → Output → Debug Console. In PHPStorm, check the Debug tool window.
-
Check Xdebug is enabled: Make sure Xdebug is enabled in slic:
slic xdebug on
-
Verify the port: Ensure port 9001 is not blocked by a firewall and that your code editor is listening on that port.
