You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/xdebug.md
+77-1Lines changed: 77 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,4 +67,80 @@ Here's a standard configuration for Xdebug in VSCode or VSCode-like editors. _(N
67
67
In this `launch.json` file, there are two `pathMappings` entries:
68
68
69
69
1. The first one maps the `slic` plugins directory (left side) to your local WP's plugins directory (right side).
70
-
2. The second one is technically optional, but it assumes you've added the `slic` directory to your VSCode workspace and maps the `slic` WP root (left side) to your local `slic` directory's WP root (right side).
70
+
2. The second one is technically optional, but it assumes you've added the `slic` directory to your VSCode workspace and maps the `slic` WP root (left side) to your local `slic` directory's WP root (right side).
71
+
72
+
## WSL2
73
+
74
+
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.
75
+
76
+
**Important:** All commands in this section should be run in your WSL2/Ubuntu terminal, not in Windows PowerShell or Command Prompt.
77
+
78
+
### Step 1: Find your WSL2 IP address
79
+
80
+
First, identify your WSL2 IP address:
81
+
82
+
```bash
83
+
hostname -I | awk '{print $1}'
84
+
```
85
+
86
+
This will output your WSL2 IP address (e.g., `172.24.206.58`).
87
+
88
+
### Step 2: Configure Xdebug to use the WSL2 IP
89
+
90
+
Configure slic's Xdebug to use your WSL2 IP address instead of the default `host.docker.internal`:
**Note:** 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](#troubleshooting) below).
103
+
104
+
### Step 3: Restart slic containers
105
+
106
+
After changing the Xdebug host, restart the slic containers to apply the changes:
107
+
108
+
```bash
109
+
slic restart
110
+
slic xdebug on
111
+
```
112
+
113
+
### Step 4: Verify the configuration
114
+
115
+
Verify that Xdebug is configured correctly:
116
+
117
+
```bash
118
+
slic xdebug status
119
+
```
120
+
121
+
You should see your WSL2 IP address in the "Remote host" field.
122
+
123
+
### Troubleshooting
124
+
125
+
If breakpoints still don't work:
126
+
127
+
1.**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:
2.**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.
140
+
141
+
3.**Check Xdebug is enabled**: Make sure Xdebug is enabled in slic:
142
+
```bash
143
+
slic xdebug on
144
+
```
145
+
146
+
4.**Verify the port**: Ensure port 9001 is not blocked by a firewall and that your code editor is listening on that port.
0 commit comments