I have a PHP project on a Windows Server 8 and I want to be able to work with those pages from VS Code and make step debugging but I don't know how to configure the launch.json correctly.
I installed Xdebug 3 on the Windows Server and it's active. The configuration that I put in php.ini
is this one:
[XDebug]
zend_extension = xdebug
xdebug.mode= debug, develop
xdebug.start_with_request=yes
xdebug.idekey=VSCODE
xdebug.remote_port = 9003
xdebug.discover_client_host = true
xdebug.client_discovery_header = HTTP_XDEBUG_IP
xdebug.show_exception_trace = 1
xdebug.connect_timeout_ms = 5000
Take into consideration that:
"11.128.7.124:3555" is the IP Windows server and port used by Apache on that server.
I open the server PHP Folder from VS Code throw a network unit.
In the Windows 8 server is installed XAMPP with PHP 7.2
I've read a lot of information but I've being able to configure the environment to do the step debugging that I can do when I open that project locally.
I also installed Xdebug extensions in Microsoft Edge and Google Chrome browsers (active).
The launch.json
file on VS Code has this configuration (No the same IP address and port):
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"11.128.7.124:3555"
],
"program": "",
"cwd": "${fileDirname}",
"port": 9003,
"pathMappings": {
"d:/xampp/htdocs/myproject": "${workspaceFolder}/htdocs",
"/myproject": "${workspaceFolder}"
},
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}
Here is the xdebug_info()
function output: