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
***I highly recommend you make a simple `test.php` file, put a `phpinfo();` statement in there,
22
+
then copy the output and paste it into the [XDebug installation wizard](https://xdebug.org/wizard.php).
23
+
It will analyze it and give you tailored installation instructions for your environment.***
24
+
In short:
25
+
- On Windows: [Download](https://xdebug.org/download.php) the appropiate precompiled DLL for your PHP version,
26
+
architecture (64/32 Bit), thread safety (TS/NTS) and Visual Studio compiler version and place it in your PHP extension folder.
27
+
- On Linux: Either download the source code as a tarball or [clone it with git](https://xdebug.org/docs/install#source),
28
+
then [compile it](https://xdebug.org/docs/install#compile).
29
+
2.[Configure PHP to use XDebug](https://xdebug.org/docs/install#configure-php) by adding `zend_extension=path/to/xdebug` to your php.ini.
30
+
The path of your php.ini is shown in your `phpinfo()` output under "Loaded Configuration File".
31
+
3. Enable remote debugging in your php.ini:
32
+
```ini
33
+
[XDebug]
34
+
xdebug.remote_enable = 1
35
+
xdebug.remote_autostart = 1
36
+
```
37
+
There are other ways to tell XDebug to connect to a remote debugger than `remote_autostart`, like cookies,
38
+
query parameters or browser extensions. I recommend `remote_autostart` because it "just works".
39
+
There are also a variety of other options, like the port (by default 9000),
40
+
please see the [XDebug documentation on remote debugging](https://xdebug.org/docs/remote#starting) for more information.
41
+
4. If you are doing web development, don't forget to restart your webserver to reload the settings
42
+
5. Verify your installation by checking your `phpinfo()` output for an XDebug section.
44
43
45
44
### VS Code Configuration
46
45
In your project, go to the debugger and hit the little gear icon and choose _PHP_.
@@ -62,7 +61,7 @@ A new launch configuration will be created for you with two configurations:
62
61
-`serverSourceRoot`: The path on the remote host where your webroot is located (for example `"/var/www"`)
63
62
-`log`: Wether to log all communication between VS Code and the adapter to the debug console.
64
63
See _Troubleshooting_ further down.
65
-
64
+
66
65
Options specific to CLI debugging:
67
66
-`program`: Path to the script that should be launched
68
67
-`args`: Arguments passed to the script
@@ -91,11 +90,14 @@ Features
91
90
Remote Host Debugging
92
91
---------------------
93
92
To debug a running application on a remote host, you need to tell XDebug to connect to a different IP than `localhost`.
94
-
This can either be done by setting `xdebug.remote_host` to your IP or by setting `xdebug.remote_connect_back`
93
+
This can either be done by setting [`xdebug.remote_host`](https://xdebug.org/docs/remote#remote_host) to your IP
94
+
or by setting [`xdebug.remote_connect_back = 1`](https://xdebug.org/docs/remote#remote_connect_back)
95
95
to make XDebug always connect back to the machine who did the web request.
96
-
The former is the only setting that supports multiple users debugging the same server and "just works" for web projects.
96
+
The latter is the only setting that supports multiple users debugging the same server and "just works" for web projects.
97
97
Again, please see the [XDebug documentation](https://xdebug.org/docs/remote#communcation) on the subject for more information.
98
-
have to set the `localSourceRoot` and `serverSourceRoot` settings in your launch.json.
98
+
99
+
To make VS Code map the files on the server to the right files on your local machine,
100
+
you have to set the `localSourceRoot` and `serverSourceRoot` settings in your launch.json.
99
101
Example:
100
102
```json
101
103
"serverSourceRoot": "/var/www/myproject",
@@ -111,7 +113,8 @@ Troubleshooting
111
113
- If you think you found a bug, [open an issue](https://github.com/felixfbecker/vscode-php-debug/issues)
112
114
- Make sure you have the latest version of this extension and XDebug installed
113
115
- Try out a simple PHP file to recreate the issue, for example from the [testproject](https://github.com/felixfbecker/vscode-php-debug/tree/master/testproject)
114
-
- In your php.ini, set `xdebug.remote_log = /path/to/logfile` (make sure your webserver has write permissions to the file)
116
+
- In your php.ini, set [`xdebug.remote_log = /path/to/logfile`](https://xdebug.org/docs/remote#remote_log)
117
+
(make sure your webserver has write permissions to the file)
0 commit comments