Skip to content

Commit c9766a6

Browse files
committed
feat: default Xdebug port changed to 9003 (#585)
* Change default Xdebug port from 9000 to 9003. * Update port in tests. Changelog.
1 parent b567271 commit c9766a6

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ jobs:
5050
ini-values: >-
5151
xdebug.mode = debug,
5252
xdebug.start_with_request = yes,
53-
xdebug.client_port = 9000,
5453
5554
xdebug.remote_enable = 1,
5655
xdebug.remote_autostart = 1,
56+
xdebug.remote_port = 9003,
5757
xdebug.remote_log = /tmp/xdebug.log
5858
- name: Run tests
5959
run: npm run cover

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1010

1111
- Option to start PHP built-in web server without router script.
1212

13+
### Changed
14+
15+
- Switched to Xdebug 3 default port 9003.
16+
1317
### Fixed
1418

1519
- Internal Source Reference for virtual source files fixed - when stepping into eval()

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ This extension is a debug adapter between VS Code and [Xdebug](https://xdebug.or
3434
```ini
3535
xdebug.mode = debug
3636
xdebug.start_with_request = yes
37-
xdebug.client_port = 9000
3837
```
3938

4039
For Xdebug v2.x.x:
4140

4241
```ini
4342
xdebug.remote_enable = 1
4443
xdebug.remote_autostart = 1
44+
xdebug.remote_port = 9003
4545
```
4646

47-
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.
47+
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.
4848

4949
4. If you are doing web development, don't forget to restart your webserver to reload the settings.
5050

@@ -55,7 +55,7 @@ This extension is a debug adapter between VS Code and [Xdebug](https://xdebug.or
5555
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 three configurations:
5656

5757
- **Listen for Xdebug**
58-
This setting will simply start listening on the specified port (by default 9000) for Xdebug. If you configured Xdebug like recommended above, every time 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.
58+
This setting will simply start listening on the specified port (by default 9003) for Xdebug. If you configured Xdebug like recommended above, every time 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.
5959
- **Launch currently open script**
6060
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.
6161
- **Launch Built-in web server**
@@ -67,7 +67,7 @@ More general information on debugging with VS Code can be found on https://code.
6767

6868
- `request`: Always `"launch"`
6969
- `hostname`: The address to bind to when listening for Xdebug (default: all IPv6 connections if available, else all IPv4 connections)
70-
- `port`: The port on which to listen for Xdebug (default: `9000`)
70+
- `port`: The port on which to listen for Xdebug (default: `9003`)
7171
- `stopOnEntry`: Whether to break at the beginning of the script (default: `false`)
7272
- `pathMappings`: A list of server paths mapping to the local source paths on your machine, see "Remote Host Debugging" below
7373
- `log`: Whether to log all communication between VS Code and the adapter to the debug console. See _Troubleshooting_ further down.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
"port": {
213213
"type": "number",
214214
"description": "Port on which to listen for Xdebug",
215-
"default": 9000
215+
"default": 9003
216216
},
217217
"serverSourceRoot": {
218218
"type": "string",
@@ -271,15 +271,15 @@
271271
"name": "Listen for Xdebug",
272272
"type": "php",
273273
"request": "launch",
274-
"port": 9000
274+
"port": 9003
275275
},
276276
{
277277
"name": "Launch currently open script",
278278
"type": "php",
279279
"request": "launch",
280280
"program": "${file}",
281281
"cwd": "${fileDirname}",
282-
"port": 9000
282+
"port": 9003
283283
},
284284
{
285285
"name": "Launch Built-in web server",
@@ -293,7 +293,7 @@
293293
],
294294
"program": "",
295295
"cwd": "${workspaceRoot}",
296-
"port": 9000,
296+
"port": 9003,
297297
"serverReadyAction": {
298298
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
299299
"uriFormat": "http://localhost:%s",
@@ -309,7 +309,7 @@
309309
"name": "Listen for Xdebug",
310310
"type": "php",
311311
"request": "launch",
312-
"port": 9000
312+
"port": 9003
313313
}
314314
},
315315
{
@@ -321,7 +321,7 @@
321321
"request": "launch",
322322
"program": "^\"${1:\\${file\\}}\"",
323323
"cwd": "^\"${2:\\${fileDirname\\}}\"",
324-
"port": 9000
324+
"port": 9003
325325
}
326326
},
327327
{
@@ -339,7 +339,7 @@
339339
],
340340
"program": "",
341341
"cwd": "^\"${2:\\${workspaceRoot\\}}\"",
342-
"port": 9000,
342+
"port": 9003,
343343
"serverReadyAction": {
344344
"pattern": "Development Server \\\\(http://localhost:([0-9]+)\\\\) started",
345345
"uriFormat": "http://localhost:%s",

src/phpDebug.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function formatPropertyValue(property: xdebug.BaseProperty): string {
5353
interface LaunchRequestArguments extends VSCodeDebugProtocol.LaunchRequestArguments {
5454
/** The address to bind to for listening for Xdebug connections (default: all IPv6 connections if available, else all IPv4 connections) */
5555
hostname?: string
56-
/** The port where the adapter should listen for Xdebug connections (default: 9000) */
56+
/** The port where the adapter should listen for Xdebug connections (default: 9003) */
5757
port?: number
5858
/** Automatically stop target after launch. If not specified, target does not stop. */
5959
stopOnEntry?: boolean
@@ -338,7 +338,7 @@ class PhpDebugSession extends vscode.DebugSession {
338338
this.sendEvent(new vscode.OutputEvent(util.inspect(error) + '\n'))
339339
this.sendErrorResponse(response, <Error>error)
340340
})
341-
server.listen(args.port || 9000, args.hostname, () => resolve())
341+
server.listen(args.port || 9003, args.hostname, () => resolve())
342342
})
343343
try {
344344
if (!args.noDebug) {

testproject/.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Listen for Xdebug",
77
"type": "php",
88
"request": "launch",
9-
"port": 9000,
9+
"port": 9003,
1010
"log": true
1111
},
1212
{
@@ -16,7 +16,7 @@
1616
"request": "launch",
1717
"program": "${file}",
1818
"cwd": "${fileDirname}",
19-
"port": 9000
19+
"port": 9003
2020
},
2121
{
2222
//"debugServer": 4711, // Uncomment for debugging the adapter
@@ -26,7 +26,7 @@
2626
"runtimeArgs": ["-dxdebug.mode=debug", "-dxdebug.start_with_request=yes", "-S", "localhost:0"],
2727
"program": "",
2828
"cwd": "${workspaceRoot}",
29-
"port": 9000,
29+
"port": 9003,
3030
"serverReadyAction": {
3131
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
3232
"uriFormat": "http://localhost:%s",

0 commit comments

Comments
 (0)