繁体   English   中英

VSCode 和 PHP 与 XDebug 和 PHP 调试扩展和 IISExpress

[英]VSCode and PHP with XDebug and PHP Debug extension and IISExpress

我正在尝试在 VS Code 中使用 PHP 调试扩展。 我已按照说明将 phpinfo 内容粘贴到向导中,并下载了相应的 dll。 我收到以下错误

发射.json

"version": "0.2.0",
"configurations": [
    {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9000,
        "log": true
        },
    {
        "name": "Launch currently open script",
        "type": "php",
        "request": "launch",
        "program": "${file}",
        "cwd": "${fileDirname}",
        "port": 9000
    }
]

php.ini

[XDEBUG]
zend_extension = C:\PHP\ext\php_xdebug-2.9.6-7.4-vc15-nts.dll
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_mode = req

如果我选择了之前启动 IISExpress 的监听选项,我会收到此错误

错误:在 Server.listen (net.js:1364) 的listenInCluster (net.js:1276:12) 处侦听 EACCES:Server.setupListenHandle [as _listen2] (net.js:1211:19) 的权限被拒绝 0.0.0.0:9000 :7) 在 c:\Users\me.vscode\extensions\felixfbecker.php-debug-1.13.0\out\phpDebug.js:236:24 在新 Promise () 在 createServer (c:\Usercodes \extensions\felixfbecker.php-debug-1.13.0\out\phpDebug.js:184:40) 在 PhpDebugSession。 (c:\Users\me.vscode\extensions\felixfbecker.php-debug-1.13.0\out\phpDebug.js:240:27) 在 Generator.next () 在 c:\Users\me.vscode\extensions\ felixfbecker.php-debug-1.13.0\out\phpDebug.js:7:71 at new Promise () { 代码:'EACCES',errno:'EACCES',系统调用:'listen',地址:'0.0.0.0' ,端口:9000 }

如果我选择其他选项并先启动 VS Code,则会收到 IISExpress 错误

无法为站点“XXXXXXX-0f34f450-230f-4d11-8878-1a90a024dcf6”应用程序“/”注册 URL“http://localhost:9000/”。 错误描述:该进程无法访问该文件,因为它正被另一个进程使用。 (0x80070020)

我知道没有使用端口 9000,因为如果我在没有运行的情况下运行此命令,它会显示没有运行

Get-Process -Id (Get-NetTCPConnection -LocalPort 9000).OwningProcess

显然双方都可以启动端口 9000,但他们不乐意共享同一个端口。 我错过了什么?

我的错误是该站点也在端口 9000 上运行。它需要与 XDebug 完全不同的端口,它在自己的端口上侦听。

iisexpress.json

{
  "port": 1785,
  "path": "C:\\YourSite",
  "clr": "v4.0",
  "protocol": "http"
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM