XDEBUG不会在断点处停止.
我try 了不同版本的XDEBUG.(当前v1.32.1、v1.32.0、v1.31.1、v1.31.0、v1.30.0)
这是我在launch.json
文件中的配置:
{
// 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": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]}
是否会与Web服务器发生冲突?
这是我在php.ini
中的配置(一直在文件的底部):
[xdebug]
zend_extension=C:\xampp\php\ext\php_xdebug.dll
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003 // it also doesnt work without this line.
安装向导
Summary from <https://xdebug.org/wizard>
• Xdebug installed: 3.2.1
• Server API: Apache 2.0 Handler
• Windows: yes
• Compiler: MS VS16
• Architecture: x64
• Zend Server: no
• PHP Version: 8.2.4
• Zend API nr: 420220829
• PHP API nr: 20220829
• Debug Build: no
• Thread Safe Build: yes
• OPcache Loaded: no
• Configuration File Path: no value
• Configuration File: C:\xampp\php\php.ini
• Extensions directory: C:\xampp\php\ext
我已从向导下载了该文件,并已正确重命名.
根据说明文件,端口9003是正确的.但我也try 过9000端口.
如果我转到https://portchecker.co/checking并判断端口9000或9003,它们已关闭.
- 我重新安装了XAMPP
- 我重新安装了VS代码
我也到了Settings -> Features -> Debug -> Allow Breakpoints Everywhere
岁.