Hello, I'm using PHP Tools for Visual Studio on VS2019. I deployed my php codes in a docker container. I setup some breakpoints in my codes and ran a debugger and I found my breakpoints were not breaking.
I checked out the xdebug log in my docker container, it seems that connection between my server and my debugger had been success established, and the breakpoints I set in my codes had been found. Here are the xdebug log in my docker container:
Log opened at 2020-04-27 02:13:45
I: Connecting to configured address/port: 192.168.58.153:9100.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///data/dev/mysite/webroot/index.php" language="PHP" xdebug:language_version="5.6.40" protocol_version="1.0" appid="7" idekey="php-vs"><engine version="2.5.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2017 by Derick Rethans]]></copyright></init>
<- breakpoint_set -i x0-10000 -t exception -x "Fatal error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x0-10000" id="70012"></response>
<- breakpoint_set -i x1-10001 -t exception -x "Parse error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x1-10001" id="70013"></response>
<- breakpoint_set -i x2-10002 -t exception -x "Unknown error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x2-10002" id="70014"></response>
<- feature_get -i 3 -n max_children
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="3" feature_name="max_children" supported="1"><![CDATA[32]]></response>
<- breakpoint_set -i 4-0 -t line -f file://C:/Users/Xavier-Lam/dev/mysite/webroot/controller/dev.do.php -n 36
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="4-0" id="70015"></response>
<- breakpoint_set -i 5-1 -t line -f file://C:/Users/Xavier-Lam/dev/mysite/webroot/controller/dev.do.php -n 37
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5-1" id="70016"></response>
<- breakpoint_set -i 6-2 -t line -f file://C:/Users/Xavier-Lam/dev/mysite/webroot/controller/dev.do.php -n 38
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6-2" id="70017"></response>
<- breakpoint_set -i 7-3 -t line -f file://C:/Users/Xavier-Lam/dev/mysite/webroot/controller/dev.do.php -n 39
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="7-3" id="70018"></response>
<- step_into -i 8
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file:///data/dev/mysite/webroot/index.php" lineno="4"></xdebug:message></response>
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
Log closed at 2020-04-27 02:13:46
The Visual Studio's output window shows that 'Auto-attach to process '[pid] php_remote.exe' on machine 'machine name' succeeded.' and once a request come in, I would receive a message that php_remote.exe has exited, the return value is -1 (0xffffffff).
I tried deploy my code on my local machine, the debugger works fine. And I tried using PHP Debug extension(felixfbecker.php-debug) on vscode, it works fine with my container too.
Here are my php.ini file using by PHP Tools for Visual Studio:
[Xdebug]
zend_extension=C:\php\php-7.1\ext\php_xdebug.dll
xdebug.remote_host=localhost
xdebug.remote_port=9100
xdebug.idekey="php-vs"
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_autostart = 1
Here are my launch.json when I'm using PHP Debug extension for VSCode:
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9100,
"pathMappings": {
"/data/dev/mysite": "${workspaceRoot}"
}
},