簡體   English   中英

嘗試使用 PHP 7.4 和 NetBeans 8.2 RC 在 Windows 上調試 ZF8756D88C7D3BDCB8E23E 8.2 RC。

[英]Trying to Debug on Windows with PHP 7.4 and NetBeans 8.2 RC under XAMPP 3.2.4

PROBLEM: I am currently unable to debug php within NetBeans 8.2 RC on Windows 10. NetBeans shows "Waiting for Connection" in lower right and never connects.

我發現的大多數教程都是幾年前的:

請注意,其中一些對 php.ini 中的 go 有不同的說明

Xdebug 東西

phpinfo()將 Xdebug 列為運行版本 2.9.4 和 IDE 鍵:netbeans-xdebug 所以至少它被識別了。 相關 php.ini [XDebug] 信息:

...
output_buffering=off
...
[XDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.4-7.4-vc15-x86_64.dll"
xdebug.idekey = netbeans-xdebug
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_connect_back = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log="c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.show_local_vars = 9
xdebug.trace_output_dir = "c:\xampp\tmp"
; 3600 (1 hour), 36000 = 10h
xdebug.remote_cookie_expire_time = 36000

來自 phpinfo() 的 xdebug 信息xdebug_1 xdebug_2 xdebug_3

'netstat -an' 結果,而 netbeans 正在等待連接在此處輸入圖像描述 注意 57418 和 9000 之間的雙向連接

xdebug 錯誤日志

[10112] Log opened at 2020-07-27 15:33:34
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] E: Time-out connecting to client (Waited: 200 ms). :-(
[10112] Log closed at 2020-07-27 15:33:34

[10112] Log opened at 2020-07-27 15:33:47
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] I: Connected to client. :-)
[10112] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/apps/wordpress/htdocs/index.php" language="PHP" xdebug:language_version="7.4.0" protocol_version="1.0" appid="10112" idekey="netbeans-xdebug"><engine version="2.9.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>

[10112] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

[10112] Log closed at 2020-07-27 15:33:51

[10112] Log opened at 2020-07-27 15:33:52
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] E: Time-out connecting to client (Waited: 200 ms). :-(
[10112] Log closed at 2020-07-27 15:33:52

[10112] Log opened at 2020-07-27 15:34:05
[10112] I: Connecting to configured address/port: 127.0.0.1:9000.
[10112] I: Connected to client. :-)
[10112] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/apps/wordpress/htdocs/index.php" language="PHP" xdebug:language_version="7.4.0" protocol_version="1.0" appid="10112" idekey="netbeans-xdebug"><engine version="2.9.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>

php_xdebug-2.9.4-7.4-vc15-x86_64.dll 是 xdebug.org/wizard 推薦的 dll,位於預期的文件位置。

NetBeans 配置

由於我正在嘗試調試 WordPress 插件,因此我將整個 'wordpress' 目錄作為我在 NetBeans 中的項目。

資料來源:

項目屬性

嗯...PHP 版本設置為 7.0,我正在嘗試使用 7.4...但它說“PHP 版本僅用於提示”。 這只是“NetBeans 8.2 RC 不支持 PHP 7.4”的簡單案例嗎?

運行配置:

運行配置

任何幫助表示贊賞。 提前致謝。 編輯:包括來自 phpinfo()、netstat 結果和 xdebug 轉儲的 xdebug 信息。

可能有幫助在更改行為以再次啟動瀏覽器后,我注意到我點擊停止之前,該項目沒有加載“?XDEBUG_SESSION_START=netbeans-xdebug”標志。 這對我來說似乎很奇怪,但我嘗試啟動調試器,點擊停止(使用標志啟動網站),然后附加調試器。 它不起作用(NetBeans 在“等待連接”上旋轉,Chrome 在“等待本地主機”上旋轉)。 Chrome 最終會加載,但是第二次我嘗試開始導航到站點的一部分以運行我正在嘗試調試的 php 代碼,它會返回到使用以下 xdebug 轉儲旋轉“等待本地主機”(它從不導航遠離主頁):

[22340] Log opened at 2020-07-27 15:49:37
[22340] I: Connecting to configured address/port: 127.0.0.1:9000.
[22340] I: Connected to client. :-)
[22340] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/apps/wordpress/htdocs/index.php" language="PHP" xdebug:language_version="7.4.0" protocol_version="1.0" appid="22340" idekey="netbeans-xdebug"><engine version="2.9.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright></init>

對於試圖讓 NetBeans 工作的可憐人來說,答案是……不要使用 NetBeans。 我知道這是一個糟糕的答案,但是經過 5 個小時的嘗試,與 20 分鍾讓 VSCode 工作 NetBeans 相比,它沒有任何意義(除非你有其他使用它的理由)。

為了讓 VSCode 工作,我主要遵循本教程: https://stackify.com/php-debugging-guide/

結合以下 php.ini 設置:

...
output_buffering=off
...
[XDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.4-7.4-vc15-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

請注意我實際需要的設置有多么少!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM