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: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,59 +8,59 @@
8
8
9
9
Install the extension: Press `F1`, type `ext install php-debug`.
10
10
11
-
This extension is a debug adapter between VS Code and [XDebug](https://xdebug.org/) by Derick Rethan. XDebug is a PHP extension (a `.so` file on Linux and a `.dll` on Windows) that needs to be installed on your server.
11
+
This extension is a debug adapter between VS Code and [Xdebug](https://xdebug.org/) by Derick Rethans. Xdebug is a PHP extension (a `.so` file on Linux and a `.dll` on Windows) that needs to be installed on your server.
**_I highly recommend you make a simple `test.php` file, put a `phpinfo();` statement in there, then copy the output and paste it into the [XDebug installation wizard](https://xdebug.org/wizard.php). It will analyze it and give you tailored installation instructions for your environment._** In short:
**_I highly recommend you make a simple `test.php` file, put a `phpinfo();` statement in there, then copy the output and paste it into the [Xdebug installation wizard](https://xdebug.org/wizard.php). It will analyze it and give you tailored installation instructions for your environment._** In short:
15
15
16
16
- On Windows: [Download](https://xdebug.org/download.php) the appropiate precompiled DLL for your PHP version, architecture (64/32 Bit), thread safety (TS/NTS) and Visual Studio compiler version and place it in your PHP extension folder.
17
17
- On Linux: Either download the source code as a tarball or [clone it with git](https://xdebug.org/docs/install#source), then [compile it](https://xdebug.org/docs/install#compile).
18
18
19
-
2.[Configure PHP to use XDebug](https://xdebug.org/docs/install#configure-php) by adding `zend_extension=path/to/xdebug` to your php.ini. The path of your php.ini is shown in your `phpinfo()` output under "Loaded Configuration File".
19
+
2.[Configure PHP to use Xdebug](https://xdebug.org/docs/install#configure-php) by adding `zend_extension=path/to/xdebug` to your php.ini. The path of your php.ini is shown in your `phpinfo()` output under "Loaded Configuration File".
20
20
21
21
3. Enable remote debugging in your `php.ini`:
22
22
23
-
For XDebug v3.x.x:
23
+
For Xdebug v3.x.x:
24
24
25
25
```ini
26
26
xdebug.mode = debug
27
27
xdebug.start_with_request = yes
28
28
xdebug.client_port = 9000
29
29
```
30
30
31
-
For XDebug v2.x.x:
31
+
For Xdebug v2.x.x:
32
32
33
33
```ini
34
34
xdebug.remote_enable = 1
35
35
xdebug.remote_autostart = 1
36
36
```
37
37
38
-
There are other ways to tell XDebug to connect to a remote debugger, like cookies, query parameters or browser extensions. I recommend `remote_autostart` (XDebug v2)/`start_with_request` (XDebug v3) because it "just works". There are also a variety of other options, like the port, please see the [XDebug documentation on remote debugging](https://xdebug.org/docs/remote#starting) for more information. Please note that the default XDebug port changed between XDebug v2 to v3 from 9000 to 9003. The extension still defaults to 9000, so make sure your configuration in `launch.json` and `php.ini` match.
38
+
There are other ways to tell Xdebug to connect to a remote debugger, like cookies, query parameters or browser extensions. I recommend `remote_autostart` (Xdebug v2)/`start_with_request` (Xdebug v3) because it "just works". There are also a variety of other options, like the port, please see the [Xdebug documentation on remote debugging](https://xdebug.org/docs/remote#starting) for more information. Please note that the default Xdebug port changed between Xdebug v2 to v3 from 9000 to 9003. The extension still defaults to 9000, so make sure your configuration in `launch.json` and `php.ini` match.
39
39
40
40
4. If you are doing web development, don't forget to restart your webserver to reload the settings.
41
41
42
-
5. Verify your installation by checking your `phpinfo()` output for an XDebug section.
42
+
5. Verify your installation by checking your `phpinfo()` output for an Xdebug section.
43
43
44
44
### VS Code Configuration
45
45
46
46
In your project, go to the debugger and hit the little gear icon and choose _PHP_. A new launch configuration will be created for you with two configurations:
47
47
48
-
-**Listen for XDebug**
49
-
This setting will simply start listening on the specified port (by default 9000) for XDebug. If you configured XDebug like recommended above, everytime you make a request with a browser to your webserver or launch a CLI script XDebug will connect and you can stop on breakpoints, exceptions etc.
48
+
-**Listen for Xdebug**
49
+
This setting will simply start listening on the specified port (by default 9000) for XDebug. If you configured XDebug like recommended above, everytime you make a request with a browser to your webserver or launch a CLI script Xdebug will connect and you can stop on breakpoints, exceptions etc.
50
50
-**Launch currently open script**
51
51
This setting is an example of CLI debugging. It will launch the currently opened script as a CLI, show all stdout/stderr output in the debug console and end the debug session once the script exits.
52
52
53
53
#### Supported launch.json settings:
54
54
55
55
-`request`: Always `"launch"`
56
56
-`hostname`: The address to bind to when listening for XDebug (default: all IPv6 connections if available, else all IPv4 connections)
57
-
-`port`: The port on which to listen for XDebug (default: `9000`)
57
+
-`port`: The port on which to listen for Xdebug (default: `9000`)
58
58
-`stopOnEntry`: Wether to break at the beginning of the script (default: `false`)
59
59
-`pathMappings`: A list of server paths mapping to the local source paths on your machine, see "Remote Host Debugging" below
60
60
-`log`: Wether to log all communication between VS Code and the adapter to the debug console. See _Troubleshooting_ further down.
61
61
-`ignore`: An optional array of glob patterns that errors should be ignored from (for example `**/vendor/**/*.php`)
62
62
-`xdebugSettings`: Allows you to override XDebug's remote debugging settings to fine tuning XDebug to your needs. For example, you can play with `max_children` and `max_depth` to change the max number of array and object children that are retrieved and the max depth in structures like arrays and objects. This can speed up the debugger on slow machines.
63
-
For a full list of feature names that can be set please refer to the [XDebug documentation](https://xdebug.org/docs-dbgp.php#feature-names).
63
+
For a full list of feature names that can be set please refer to the [Xdebug documentation](https://xdebug.org/docs-dbgp.php#feature-names).
64
64
-`max_children`: max number of array or object children to initially retrieve
65
65
-`max_data`: max amount of variable data to initially retrieve.
66
66
-`max_depth`: maximum depth that the debugger engine may return when sending arrays, hashs or object structures to the IDE.
@@ -94,7 +94,7 @@ Options specific to CLI debugging:
94
94
95
95
## Remote Host Debugging
96
96
97
-
To debug a running application on a remote host, you need to tell XDebug to connect to a different IP than `localhost`. This can either be done by setting [`xdebug.remote_host`](https://xdebug.org/docs/remote#remote_host) to your IP or by setting [`xdebug.remote_connect_back = 1`](https://xdebug.org/docs/remote#remote_connect_back) to make XDebug always connect back to the machine who did the web request. The latter is the only setting that supports multiple users debugging the same server and "just works" for web projects. Again, please see the [XDebug documentation](https://xdebug.org/docs/remote#communcation) on the subject for more information.
97
+
To debug a running application on a remote host, you need to tell Xdebug to connect to a different IP than `localhost`. This can either be done by setting [`xdebug.remote_host`](https://xdebug.org/docs/remote#remote_host) to your IP or by setting [`xdebug.remote_connect_back = 1`](https://xdebug.org/docs/remote#remote_connect_back) to make Xdebug always connect back to the machine who did the web request. The latter is the only setting that supports multiple users debugging the same server and "just works" for web projects. Again, please see the [Xdebug documentation](https://xdebug.org/docs/remote#communcation) on the subject for more information.
98
98
99
99
To make VS Code map the files on the server to the right files on your local machine, you have to set the `pathMappings` settings in your launch.json. Example:
100
100
@@ -112,7 +112,7 @@ Please also note that setting any of the CLI debugging options will not work wit
112
112
113
113
- Ask a question on [StackOverflow](https://stackoverflow.com/)
114
114
- If you think you found a bug, [open an issue](https://github.com/xdebug/vscode-php-debug/issues)
115
-
- Make sure you have the latest version of this extension and XDebug installed
115
+
- Make sure you have the latest version of this extension and Xdebug installed
116
116
- Try out a simple PHP file to recreate the issue, for example from the [testproject](https://github.com/xdebug/vscode-php-debug/tree/main/testproject)
117
117
- In your php.ini, set [`xdebug.remote_log = /path/to/logfile`](https://xdebug.org/docs/remote#remote_log)
118
118
(make sure your webserver has write permissions to the file)
0 commit comments