Skip to content

Commit 4d19dd2

Browse files
committed
Improve README further
1 parent 6374af2 commit 4d19dd2

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

README.md

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,30 @@ Install the extension: Press `F1`, type `ext install php-debug`.
1616

1717
This extension is a debug adapter between VS Code and [XDebug](https://xdebug.org/) by Derick Rethan.
1818
XDebug is a PHP extension (a `.so` file on Linux and a `.dll` on Windows) that needs to be installed on your server.
19-
There are installation instructions available [here].
20-
21-
1. [Install XDebug](https://xdebug.org/docs/install)
22-
***I highly recommend you make a simple `test.php` file, put a `phpinfo();` statement in there,
23-
then copy the output and paste it into the [XDebug installation wizard](https://xdebug.org/wizard.php).
24-
It will analyze it and give you tailored installation instructions for your environment.***
25-
In short:
26-
- On Windows: [Download](https://xdebug.org/download.php) the appropiate precompiled DLL for your PHP version,
27-
architecture (64/32 Bit), thread safety (TS/NTS) and Visual Studio compiler version and place it in your PHP extension folder.
28-
- On Linux: Either download the source code as a tarball or [clone it with git](https://xdebug.org/docs/install#source),
29-
then [compile it](https://xdebug.org/docs/install#compile).
30-
- Reference the extension in your php.ini by adding `zend_extension=path/to/xdebug`.
31-
The path of your php.ini is shown in your `phpinfo()` output under "Loaded Configuration File".
32-
- Enable remote debugging in your php.ini:
33-
```ini
34-
[XDebug]
35-
xdebug.remote_enable = 1
36-
xdebug.remote_autostart = 1
37-
```
38-
There are other ways to tell XDebug to connect to a remote debugger than `remote_autostart`, like cookies,
39-
query parameters or browser extensions. I recommend `remote_autostart` because it "just works".
40-
There are also a variety of other options, like the port (by default 9000),
41-
please see the [XDebug documentation on remote debugging](https://xdebug.org/docs/remote#starting) for more information.
42-
- If you are doing web development, don't forget to restart your webserver to reload the settings
43-
- Verify your installation by checking your `phpinfo()` output for an XDebug section.
19+
20+
1. [Install XDebug](https://xdebug.org/docs/install)
21+
***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.
4443

4544
### VS Code Configuration
4645
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:
6261
- `serverSourceRoot`: The path on the remote host where your webroot is located (for example `"/var/www"`)
6362
- `log`: Wether to log all communication between VS Code and the adapter to the debug console.
6463
See _Troubleshooting_ further down.
65-
64+
6665
Options specific to CLI debugging:
6766
- `program`: Path to the script that should be launched
6867
- `args`: Arguments passed to the script
@@ -91,11 +90,14 @@ Features
9190
Remote Host Debugging
9291
---------------------
9392
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)
9595
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.
9797
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.
99101
Example:
100102
```json
101103
"serverSourceRoot": "/var/www/myproject",
@@ -111,7 +113,8 @@ Troubleshooting
111113
- If you think you found a bug, [open an issue](https://github.com/felixfbecker/vscode-php-debug/issues)
112114
- Make sure you have the latest version of this extension and XDebug installed
113115
- 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)
115118
- Set `"log": true` in your launch.json
116119

117120
Contributing

0 commit comments

Comments
 (0)