|
2 | 2 | title: Quick Start |
3 | 3 | --- |
4 | 4 |
|
5 | | -Get up and running with PHP Debugger in a few minutes. This guide assumes you have already [installed](./installation.mdx) the extension. |
| 5 | +You have [installed](./installation.mdx) PHP Debugger. This is everything else — |
| 6 | +which, in most cases, is nothing at all. |
6 | 7 |
|
7 | | -## 1. Enable the debugger |
| 8 | +## 1. Load it |
8 | 9 |
|
9 | | -Add the following to your `php.ini` file: |
| 10 | +**If you installed the interpreter** — the build with the debugger compiled in, |
| 11 | +which is what the installer and the Docker images give you by default — there is |
| 12 | +nothing to load. Skip to step 3. |
| 13 | + |
| 14 | +**If you installed the extension**, one line in `php.ini`: |
10 | 15 |
|
11 | 16 | ```ini |
12 | | -zend_extension=php_debugger |
13 | | -php_debugger.mode=debug |
14 | | -php_debugger.start_with_request=trigger |
| 17 | +zend_extension=php_debugger.so |
15 | 18 | ``` |
16 | 19 |
|
17 | | -## 2. Start listening in your IDE |
| 20 | +It has to be `zend_extension`, not `extension`. |
18 | 21 |
|
19 | | -Configure your IDE to listen for debug connections on port `9003` (the default). See the [IDE Support](../integrations/ide-support.md) guide for instructions for PhpStorm, VS Code, and Neovim. |
| 22 | +## 2. Delete everything else |
20 | 23 |
|
21 | | -## 3. Set a breakpoint and run |
| 24 | +Debugging is on by default and starts with every request, so the settings you may |
| 25 | +be used to are unnecessary. Remove them if they are already there: |
22 | 26 |
|
23 | | -Set a breakpoint in your editor, then trigger a debug session: |
| 27 | +- `php_debugger.mode` (or `xdebug.mode`) — already `debug` |
| 28 | +- `php_debugger.start_with_request` (or `xdebug.start_with_request`) — already `yes` |
| 29 | +- any line loading Xdebug, such as `zend_extension=xdebug.so` — PHP Debugger takes |
| 30 | + its place, and loading both will not work |
24 | 31 |
|
25 | | -- **Web request**: add `XDEBUG_TRIGGER=1` as a cookie, GET, or POST parameter. |
26 | | -- **CLI script**: set the trigger in the environment: |
| 32 | +There is no trigger to set and no environment variable to remember. |
27 | 33 |
|
28 | | -```bash |
29 | | -XDEBUG_TRIGGER=1 php your-script.php |
30 | | -``` |
| 34 | +## 3. Check where it connects |
| 35 | + |
| 36 | +The debugger connects out to your editor. Two settings decide where: |
| 37 | + |
| 38 | +| Setting | Default | |
| 39 | +| --- | --- | |
| 40 | +| `php_debugger.client_host` | `localhost` | |
| 41 | +| `php_debugger.client_port` | `9003` | |
| 42 | + |
| 43 | +Those are right when your editor and your code run on the same machine. They are |
| 44 | +not right from inside a container, where `localhost` is the container itself — see |
| 45 | +[Docker](./docker.mdx) for the setup that fixes it. |
| 46 | + |
| 47 | +## 4. Set a breakpoint |
| 48 | + |
| 49 | +Start your editor listening on port `9003`, set a breakpoint, and run your code. |
| 50 | +The debugger connects, pauses, and hands you the session. |
31 | 51 |
|
32 | | -The debugger connects to your IDE, pauses at your breakpoint, and you can step through code, inspect variables, and evaluate expressions. |
| 52 | +See [IDE Support](../integrations/ide-support.md) for PhpStorm, VS Code and Neovim. |
33 | 53 |
|
34 | 54 | ## Next steps |
35 | 55 |
|
36 | | -- Learn about [breakpoints](../user-guide/breakpoints.md) and [step debugging](../user-guide/step-debugging.md). |
37 | | -- Fine-tune behaviour in the [Configuration](./configuration.md) guide. |
| 56 | +- [Breakpoints](../user-guide/breakpoints.md) and [step debugging](../user-guide/step-debugging.md) |
| 57 | +- [Configuration](./configuration.md) — everything you can change, if you need to |
0 commit comments