微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Visual Studio代码不会在PHP Xdebug中的断点处停止

我从Thinkpad笔记本电脑转到HP Elitebook.我必须在我的新笔记本电脑中设置我的开发环境.在Windows 10 Pro 64位版本中设置我的Visual Studio代码和XAMPP后,我无法调试我的PHP代码.

我已经为Visual Studio Code正确安装了Xdebug扩展,并确保PHP.ini正确.这是我对PHP.ini的设置(我使用便携式XAMPP放在E:驱动器上):

zend_extension = "E:\xampp\PHP\ext\PHP_xdebug-2.4.1-5.4-vc9.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_log="E:\xampp\apache\logs\xdebug.log"

我的xdebug.log显示如下信息:

Log opened at 2018-10-27 05:56:45
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:///E:/xampp/htdocs/absen/index.PHP" language="PHP" xdebug:language_version="5.4.3-dev" protocol_version="1.0" appid="7112" idekey="william"><engine version="2.4.1"><![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>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Log closed at 2018-10-27 05:56:45

但我的Visual Studio代码不会在断点处停止.

我已重新安装我的Visual Studio代码,XAMPP,并使用另一个Xdebug版本,但它仍然无法正常工作.

我有以下链接

> visual studio code PHP debugging not working
> xdebug won’t stop at breakpoint
> xdebug breakpoint fail
> Xdebug successfully connects to DBGP clients, but won’t stop at breakpoints

这些解决方案都不起作用.

解决方法:

最后我知道问题的根源. HP Elitebook预装了名为HP VeLocity的程序,该程序使用端口9000.

问题是我的主机端口9000绑定到HP VeLocity软件的端口9000.当HP VeLocity服务连接到localhost xdebug服务器时,日志表明连接正常,但它已连接到HP VeLocity.

我在PHP.ini中将xdebug端口更改为9090,并在visual studio代码中的launch.json中进行了更改.之后,我的visual studio代码照常工作,可以在断点处停止.

希望这能帮到别人:)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐