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
Press <kbd>F1</kbd>, type `ext install php-debug`.
11
+
12
+
### Install XDebug:
13
+
[Download and install the XDebug extension](http://xdebug.org/download.php).
14
+
Then, in addition to `zend_extension=path/to/xdebug`, add these lines to your php.ini to enable remote debugging:
15
+
16
+
```ini
17
+
[XDebug]
18
+
xdebug.remote_enable = 1
19
+
xdebug.remote_autostart = 1
20
+
```
21
+
Also, if you haven't already, point your webserver's webroot to your project.
22
+
23
+
Don't forget to restart your webserver after you made these changes.
24
+
Now, everytime you do a request to a PHP file, XDebug will automatically try to connect to port 9000 for debugging.
25
+
26
+
### Start debugging:
27
+
In your project, go to the debugger and hit the little gear icon. Choose PHP. A new launch configuration will be created for you.
28
+
Now, if you select this configuration and hit <kbd>F5</kbd>, VS Code will listen on port 9000 for incoming XDebug requests.
29
+
Now, when you make a request to `localhost` with your webbrowser, XDebug will connect to VS Code and you can debug your PHP.
30
+
31
+
What is supported?
32
+
------------------
33
+
- Line breakpoints
34
+
- Step over, step in, step out
35
+
- Break on entry
36
+
- Breaking on uncaught exceptions and errors / warnings / notices
37
+
- Multiple, parallel requests (still a bit buggy but I think these are bugs in VS Code)
38
+
- Stack traces, scope variables, superglobals, user defined constants
39
+
- Arrays & objects (including classname, private and static properties)
40
+
- Debug console
41
+
- Watches
42
+
43
+
What is not supported?
44
+
----------------------
45
+
- Conditional breakpoints (not yet implemented)
46
+
- Breaking on _caught_ exceptions, this is not supported by XDebug and the setting is ignored
47
+
- Attach requests, there is no such thing because the lifespan of PHP scripts is short
48
+
49
+
FAQ
50
+
---
51
+
52
+
#### How can I get the error message when breaking on an error/warning?
53
+
Set a watch for `error_get_last()`
54
+
55
+
#### Where are the variables of the parent scope?
56
+
In opposite to Javascript, PHP does not have closures.
57
+
A scope contains only variables that have been declared, parameters and imported globals with `global` or `use`.
58
+
If you want to see the variables of the scope of the callee, click on it in the stacktrace.
59
+
60
+
Contributing
61
+
------------
62
+
To hack on this adapter, clone the repository and open it in VS Code.
63
+
You can debug it (run it in "server mode") by selecting the "Debug adapter" launch configuration and hitting <kbd>F5</kbd>.
64
+
Then, open a terminal inside the project, and open the included testproject with VS Code while specifying the current directory as `extensionDevelopmentPath`.
65
+
As an example, for Powershell on Windows it could look like this:
0 commit comments