Skip to content

Commit 54a2b9e

Browse files
Merge pull request #21 from php-debugger/settings-reference
write the settings reference page
2 parents c26fff1 + 46a5772 commit 54a2b9e

3 files changed

Lines changed: 316 additions & 10 deletions

File tree

docs/reference/configuration-file.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/reference/settings.md

Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
---
2+
title: Settings
3+
---
4+
5+
Every setting PHP Debugger supports, in alphabetical order.
6+
7+
Each setting says where it can be set:
8+
9+
- **Anywhere**`php.ini`, a `conf.d` file, per-directory config, or at runtime
10+
with `ini_set()`.
11+
- **System and per-directory**`php.ini` and per-directory config such as
12+
`.htaccess` or a vhost, but not at runtime.
13+
- **`php.ini` only** — read once at startup, so changing it later has no effect.
14+
15+
## `php_debugger.client_discovery_header`
16+
17+
| Type | Default | Set in |
18+
| --- | --- | --- |
19+
| String | `HTTP_X_FORWARDED_FOR,REMOTE_ADDR` | Anywhere |
20+
21+
The request headers consulted, in order, when
22+
[`discover_client_host`](#php_debuggerdiscover_client_host) is on. The first one
23+
present supplies the address; if it holds a comma-separated list, the first entry
24+
is used.
25+
26+
```ini
27+
php_debugger.client_discovery_header=HTTP_X_REAL_IP,REMOTE_ADDR
28+
```
29+
30+
## `php_debugger.client_host`
31+
32+
| Type | Default | Set in |
33+
| --- | --- | --- |
34+
| String | `localhost` | Anywhere |
35+
36+
The machine the debugger connects out to. The default works when your editor and
37+
your code run on the same machine; from inside a container it needs an address that
38+
reaches your host.
39+
40+
```ini
41+
php_debugger.client_host=host.docker.internal
42+
```
43+
44+
## `php_debugger.client_port`
45+
46+
| Type | Default | Set in |
47+
| --- | --- | --- |
48+
| Integer | `9003` | Anywhere |
49+
50+
The port your editor is listening on. Change it only if something else already has
51+
`9003`, and make your editor match.
52+
53+
```ini
54+
php_debugger.client_port=9004
55+
```
56+
57+
## `php_debugger.cloud_id`
58+
59+
| Type | Default | Set in |
60+
| --- | --- | --- |
61+
| String | empty | `php.ini` only |
62+
63+
Relays the session through Xdebug Cloud rather than connecting directly, for when
64+
the debugger cannot reach your machine at all. Setting it takes priority over
65+
`client_host`. See the [Xdebug Cloud documentation](https://xdebug.org/docs/cloud).
66+
67+
```ini
68+
php_debugger.cloud_id=your-id-here
69+
```
70+
71+
## `php_debugger.connect_timeout_ms`
72+
73+
| Type | Default | Set in |
74+
| --- | --- | --- |
75+
| Integer | `200` | Anywhere |
76+
77+
How long, in milliseconds, a single connection attempt may take. Every attempt that
78+
finds nothing listening costs the request this much, which is why the default is
79+
small.
80+
81+
```ini
82+
php_debugger.connect_timeout_ms=500
83+
```
84+
85+
## `php_debugger.control_socket`
86+
87+
| Type | Default | Set in |
88+
| --- | --- | --- |
89+
| String | `default` | Anywhere. Linux only |
90+
91+
Opens a per-process socket that lets an external tool inspect a running request or
92+
pause it. `default` and `time` both poll every 25ms; `no` turns it off. On a system
93+
without a usable TSC clock, `default` disables itself and `time` falls back to
94+
100ms.
95+
96+
```ini
97+
php_debugger.control_socket=no
98+
```
99+
100+
## `php_debugger.discover_client_host`
101+
102+
| Type | Default | Set in |
103+
| --- | --- | --- |
104+
| Boolean | `0` | Anywhere |
105+
106+
Works the client address out from the incoming HTTP request instead of using
107+
`client_host`. Only the host is discovered — the port is always `client_port` — and
108+
`client_host` is still used as a fallback.
109+
110+
Because the headers it reads are supplied by the request, only enable this behind a
111+
proxy you control.
112+
113+
```ini
114+
php_debugger.discover_client_host=1
115+
```
116+
117+
## `php_debugger.idekey`
118+
119+
| Type | Default | Set in |
120+
| --- | --- | --- |
121+
| String | empty | Anywhere |
122+
123+
An identifier sent to your editor when the session opens, so a client handling
124+
several sessions can tell them apart. Most setups never need it.
125+
126+
```ini
127+
php_debugger.idekey=my-project
128+
```
129+
130+
## `php_debugger.log`
131+
132+
| Type | Default | Set in |
133+
| --- | --- | --- |
134+
| String | empty | Anywhere |
135+
136+
The file where the debugger writes its own log. Appended to rather than truncated,
137+
and flushed line by line, so a crash does not cost you the last entry. Leave it
138+
unset outside of debugging: it grows without limit and records paths, trigger
139+
values and protocol traffic.
140+
141+
```ini
142+
php_debugger.log=/tmp/php-debugger.log
143+
```
144+
145+
## `php_debugger.log_level`
146+
147+
| Type | Default | Set in |
148+
| --- | --- | --- |
149+
| Integer | `7` | Anywhere |
150+
151+
How much is written to the log. A threshold — everything at or below the number is
152+
recorded.
153+
154+
| Value | Records |
155+
| --- | --- |
156+
| `0` | Critical failures only. |
157+
| `1` | Errors as well. |
158+
| `3` | Warnings as well. |
159+
| `5` | Every protocol message in both directions. |
160+
| `7` | Connections, sessions and breakpoint resolution. The default. |
161+
| `10` | Everything, including each trigger check and configuration decision. |
162+
163+
```ini
164+
php_debugger.log_level=10
165+
```
166+
167+
## `php_debugger.mode`
168+
169+
| Type | Default | Set in |
170+
| --- | --- | --- |
171+
| String | `debug` | `php.ini` only |
172+
173+
Whether the debugger does anything at all. Two values are accepted: `debug`, and
174+
`off` for no overhead rather than very little. Any other value is ignored: a
175+
message is logged and the mode stays `debug`.
176+
177+
```ini
178+
php_debugger.mode=off
179+
```
180+
181+
## `php_debugger.on_demand_debugging_enabled`
182+
183+
| Type | Default | Set in |
184+
| --- | --- | --- |
185+
| Boolean | `0` | `php.ini` only |
186+
187+
Allows the debugger to attach part-way through a request, which is what makes
188+
`php_debugger_break()` and `php_debugger_connect_to_client()` work when no session
189+
is running.
190+
191+
The cost is high: every request must be compiled with debugging instrumentation
192+
whether or not it ends up being debugged, which gives away roughly half of the
193+
near-zero overhead you would otherwise have. Leave it off unless you need it.
194+
195+
```ini
196+
php_debugger.on_demand_debugging_enabled=1
197+
```
198+
199+
## `php_debugger.path_mapping`
200+
201+
| Type | Default | Set in |
202+
| --- | --- | --- |
203+
| Boolean | `0` | Anywhere |
204+
205+
Enables server-side translation between the paths the running machine sees and the
206+
paths your editor knows. With it off, paths are passed through unchanged.
207+
208+
Most setups do not need this — mapping is normally configured in the editor, which
209+
is where to look first if breakpoints in a container are being ignored.
210+
211+
```ini
212+
php_debugger.path_mapping=1
213+
```
214+
215+
## `php_debugger.start_upon_error`
216+
217+
| Type | Default | Set in |
218+
| --- | --- | --- |
219+
| String | `default` | System and per-directory |
220+
221+
Whether an error should start a debugging session when none is running. Only `yes`
222+
enables it; `default` and `no` both leave it off. It also needs
223+
[`on_demand_debugging_enabled`](#php_debuggeron_demand_debugging_enabled), since
224+
starting mid-request is exactly what that setting permits.
225+
226+
```ini
227+
php_debugger.start_upon_error=yes
228+
```
229+
230+
## `php_debugger.start_with_request`
231+
232+
| Type | Default | Set in |
233+
| --- | --- | --- |
234+
| String | `yes` | System and per-directory |
235+
236+
When a session begins.
237+
238+
| Value | Meaning |
239+
| --- | --- |
240+
| `yes` | Every request starts one. The default. |
241+
| `no` | Never. |
242+
| `trigger` | Only when a trigger is present in the request. |
243+
244+
`yes` is the right choice here. `trigger` exists to keep a heavyweight debugger out
245+
of the way, which is not a problem this one has.
246+
247+
```ini
248+
php_debugger.start_with_request=trigger
249+
```
250+
251+
## `php_debugger.trigger_value`
252+
253+
| Type | Default | Set in |
254+
| --- | --- | --- |
255+
| String | empty | System and per-directory |
256+
257+
Turns the trigger into a shared secret: with a value set, a trigger only counts if
258+
it matches, and one that does not is refused and logged. Several secrets can be
259+
accepted at once by separating them with commas.
260+
261+
Only relevant when `start_with_request` is `trigger`.
262+
263+
```ini
264+
php_debugger.trigger_value=letmein,alsofine
265+
```
266+
267+
## `php_debugger.var_display_max_children`
268+
269+
| Type | Default | Set in |
270+
| --- | --- | --- |
271+
| Integer | `128` | Anywhere |
272+
273+
How many elements of an array or object are sent in one go. Your editor can raise
274+
this for its own session, and usually does, in which case its value wins.
275+
276+
```ini
277+
php_debugger.var_display_max_children=256
278+
```
279+
280+
## `php_debugger.var_display_max_data`
281+
282+
| Type | Default | Set in |
283+
| --- | --- | --- |
284+
| Integer | `512` | Anywhere |
285+
286+
How many bytes of a string are sent before it is truncated. Also overridable by
287+
your editor.
288+
289+
```ini
290+
php_debugger.var_display_max_data=2048
291+
```
292+
293+
## `php_debugger.var_display_max_depth`
294+
295+
| Type | Default | Set in |
296+
| --- | --- | --- |
297+
| Integer | `3` | Anywhere |
298+
299+
How many levels deep into a nested structure are sent in one go. Expanding a node
300+
in your editor fetches the next layer, so this is a batch size rather than a limit
301+
on what you can reach. Also overridable by your editor.
302+
303+
```ini
304+
php_debugger.var_display_max_depth=5
305+
```
306+
307+
:::info[The `xdebug.` prefix also works]
308+
309+
Every setting on this page can also be written with an `xdebug.` prefix instead of
310+
`php_debugger.`. The two names share a single value, so either spelling has the
311+
same effect, and where both are set explicitly `php_debugger.` wins.
312+
313+
This is what lets an existing configuration carry on working untouched.
314+
315+
:::

sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ const sidebars = {
4747
label: 'Reference',
4848
collapsed: false,
4949
items: [
50+
'reference/settings',
5051
'reference/cli-options',
5152
'reference/environment-variables',
52-
'reference/configuration-file',
5353
'reference/debug-protocol',
5454
],
5555
},

0 commit comments

Comments
 (0)