I'm trying to configure xdebug with VSCode (VSCcode version 1.9.1).
php.ini
[Xdebug]
zend_extension = D:\php\ext\php_xdebug.dll
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_log = D:\site\xlog.txt
My default php port is 3000. ($_SERVER['SERVER_PORT'] = 3000
I can actually run phpinfo()
at localhost:3000
and Xdebug port is set as xdebug.remote_port = 9000
Xdebug log:
Log opened at 2017-02-17 20:50:56
I: Connecting to configured address/port: localhost:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///D:/site/index.php" language="PHP" xdebug:language_version="7.1.0-dev" protocol_version="1.0" appid="11384" idekey="Admin"><engine version="2.5.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>
<- breakpoint_list -i 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="1"></response>
<- breakpoint_list -i 2
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="2"></response>
<- breakpoint_set -i 3 -t exception -x *
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3" id="113840001"></response>
<- run -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="stopping" reason="ok"></response>
<- stop -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stop" transaction_id="5" status="stopped" reason="ok"></response>
Log closed at 2017-02-17 20:50:56
launch.json:
{
"version": "0.2.0",
"configurations":
[{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
For the following test code :
$var = "test\n";
print $var;
var_dump($var);
I get this in the debug console :
test D:\site\index.php:5: string(5) "test "
But no variables in the debug list..
I don't know why but the variables don't appear in VSCode.
When I try to reach localhost:3000
... here is what I get:
Log opened at 2017-02-17 21:38:16
I: Connecting to configured address/port: localhost:9000.
E: Time-out connecting to client. :-(
Log closed at 2017-02-17 21:38:17