我已经从我的Thinkpad笔记本电脑转移到惠普Elitebook。我必须在我的新笔记本电脑中设置我的开发环境。在Windows 10 Pro 64位版本中设置了我的Visual代码和XAMPP之后,我无法调试我的PHP代码。
我已经正确安装了Visual代码的Xdebug扩展,并确保php.ini正确。这是我为php.ini设置的(我使用了放在E:驱动器上的便携式XAMPP ):
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代码不会在断点停止。
我已经重新安装了Visual代码XAMPP,并使用了另一个Xdebug版本,但它仍然无法工作。
我有以下几个链接:
这些解决方案都不起作用。
发布于 2018-10-27 12:02:44
最后,我知道了问题的根源。have已经预装了名为HP流速的程序,该程序使用了端口9000。
问题是来自我的主机的9000端口是绑定到惠普速度软件的端口9000。当HP服务连接到本地主机xdebug服务器时,日志显示连接是正常的,但它连接到了HP流速。
在php.ini中,我将x调试端口更改为9090,在visual代码中更改了launch.json。在此之后,我的visual studio代码可以像往常一样工作,并且可以在断点停止。
希望这能帮助其他人:)
发布于 2021-02-01 13:40:28
这就是我解决了同样的问题,如果以前的答案没有帮助的话,值得一试。
php.ini
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-3.0.2-8.0-vs16-x86_64.dll"
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.client_host = "127.0.0.1"
xdebug.log = "C:\xampp\tmp\xdebug\xdebug.log"
xdebug.idekey = VSCODElaunch.json
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"type": "php",
"request": "launch",
"name": "Run using local PHP Interpreter",
"program": "${file}",
"runtimeExecutable": "C:\\xampp\\php\\php.exe"
}
]发布于 2020-05-24 18:56:42
在我的例子中,pathMappings是不正确的,并且没有更改端口。
{
...
"configurations": [
{
...
"port": 9000,
"pathMappings": {
"/var/www/yourproject": "${workspaceFolder}/",
}
}
]
}如果我检查“所有”断点(它捕获了一个被抑制的异常,但是VS代码警告没有找到该文件),我的断点实际上是工作的。
https://stackoverflow.com/questions/53021711
复制相似问题