xDebug未与Netbeans

时间:2015-08-16 18:22:15

标签: xdebug netbeans-8

我有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尝试了相同的配置并且它有效 - &gt;所以这可能是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

1 个答案:

答案 0 :(得分:0)

在您拥有的设置中

xdebug.remote_host =&gt;本地主机

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

XDebug示例静态ip /单个开发人员:

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

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