簡體   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