【问题标题】:xDebug not connecting with NetbeansxDebug 未与 Netbeans 连接
【发布时间】:2015-08-17 04:11:56
【问题描述】:

我有 vm (centos 7, apache, php 5.4)。小型测试 php 脚本可以正常工作。当我尝试调试它时,Netbeans(Windows 8.1 上的 8.0.2)显示“等待连接”,没有任何反应。我正在使用从 vm 端口 9005 到主机端口 9005 的 ssh 隧道。

xdebug 日志:

Log opened at 2015-08-16 18:11:22
I: Connecting to configured address/port: localhost:9005.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/project/html/index.php" language="PHP" protocol_version="1.0" appid="55867" idekey="netbeans-xdebug"><engine version="2.3.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 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 2015-08-16 18:11:24

php -i 的结果:

xdebug support => enabled
IDE Key => netbeans-xdebug
xdebug.auto_trace => Off 
xdebug.cli_color => 0 
xdebug.collect_assignments => Off 
xdebug.collect_includes => On
xdebug.collect_params => 0
xdebug.collect_return => Off 
xdebug.collect_vars => Off
xdebug.coverage_enable => On 
xdebug.default_enable => On 
xdebug.dump.COOKIE => no value 
xdebug.dump.ENV => no value 
xdebug.dump.FILES => no value
xdebug.dump.GET => no value 
xdebug.dump.POST => no value 
xdebug.dump.REQUEST => no value 
xdebug.dump.SERVER => no value 
xdebug.dump.SESSION => no value 
xdebug.dump_globals => On 
xdebug.dump_once => On 
xdebug.dump_undefined => Off
xdebug.extended_info => On
xdebug.file_link_format => no value
xdebug.force_display_errors => Off
xdebug.force_error_reporting => 0
xdebug.halt_level => 0
xdebug.idekey => netbeans-xdebug
xdebug.max_nesting_level => 256
xdebug.max_stack_frames => -1
xdebug.overload_var_dump => On
xdebug.profiler_aggregate => Off
xdebug.profiler_append => Off
xdebug.profiler_enable => Off
xdebug.profiler_enable_trigger => Off
xdebug.profiler_enable_trigger_value => no value
xdebug.profiler_output_dir => /tmp
xdebug.profiler_output_name => cachegrind.out.%p
xdebug.remote_autostart => Off
xdebug.remote_connect_back => Off
xdebug.remote_cookie_expire_time => 3600
xdebug.remote_enable => On
xdebug.remote_handler => dbgp
xdebug.remote_host => localhost
xdebug.remote_log => /var/log/xdebug/debug.log
xdebug.remote_mode => req
xdebug.remote_port => 9005
xdebug.scream => Off
xdebug.show_exception_trace => Off
xdebug.show_local_vars => Off
xdebug.show_mem_delta => Off
xdebug.trace_enable_trigger => Off
xdebug.trace_enable_trigger_value => no value 
xdebug.trace_format => 0 
xdebug.trace_options => 0 
xdebug.trace_output_dir => /tmp
xdebug.trace_output_name => trace.%c 
xdebug.var_display_max_children => 128
xdebug.var_display_max_data => 2048
xdebug.var_display_max_depth => 3

我用 XDebugClient 尝试了相同的配置,它工作了 -> 所以它可能是 Netbeans 的一些问题。

使用 XDebugClient 进行远程日志:

Log opened at 2015-08-16 19:43:51
I: Connecting to configured address/port: localhost:9005.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/project/html/index.php" language="PHP" protocol_version="1.0" appid="58314" idekey="netbeans-xdebug"><engine version="2.3.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>

<- run -i xdc2
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="xdc2" status="break" reason="ok"><xdebug:message filename="file:///var/www/project/html/index.php" lineno="13"></xdebug:message></response>

<- step_out -i xdc10
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_out" transaction_id="xdc10" status="stopping" reason="ok"></response>

Log closed at 2015-08-16 19:45:11

【问题讨论】:

  • 重启IDE后问题消失

标签: xdebug netbeans-8


【解决方案1】:

在您的设置中

xdebug.remote_host => 本地主机

你应该有远程机器的IP地址(运行netbeans的那个),我假设你应该在windows防火墙上打开调试端口,这样centos就可以连接回你的netbeans中的那个端口。我还没有在其他机器上进行远程调试,总是本地的,但这应该可以。

XDebug 示例静态 ip/单一开发者:

  • 服务器的 IP 是 10.0.1.2,HTTP 端口是 80
  • IDE 位于 IP 10.0.1.42,因此 xdebug.remote_host 设置为 10.0.1.42
  • IDE 监听 9000 端口,所以 xdebug.remote_port 设置为 9000
  • HTTP 请求在运行 IDE 的机器上启动
  • Xdebug 连接到 10.0.1.42:9000
  • 调试运行,提供 HTTP 响应

Xdebug 文档: http://xdebug.org/docs/remote

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-16
    • 2013-07-10
    • 2010-12-29
    • 2013-12-15
    • 1970-01-01
    相关资源
    最近更新 更多