netbeans显示“等待连接(netbeans-xdebug)”

时间:2018-01-09 00:37:47

标签: debugging netbeans xdebug

似乎无法让netbeans停在我的断点处。

当我运行我的调试器时,我得到了“等待连接(netbeans-xdebug)”的永无止境的状态。

在phpinfo中我可以看到以下内容

> xdebug xdebug support enabled Version 2.6.0beta1 IDE Key  mysession
> Supported protocols   Revision DBGp - Common DeBuGger
> Protocol  $Revision: 1.145 $ Directive    Local Value Master Value
> xdebug.auto_trace Off Off xdebug.cli_color    0   0
> xdebug.collect_assignments    Off Off xdebug.collect_includes On  On
> xdebug.collect_params 0   0 xdebug.collect_return Off Off
> xdebug.collect_vars   Off Off xdebug.coverage_enable  On  On
> xdebug.default_enable On  On xdebug.dump.COOKIE   no value    no value
> xdebug.dump.ENV   no value    no value xdebug.dump.FILES  no value    no value
> xdebug.dump.GET   no value    no value xdebug.dump.POST   no value    no value
> xdebug.dump.REQUEST   no value    no value xdebug.dump.SERVER no value    no
> value xdebug.dump.SESSION no value    no value xdebug.dump_globals    On  On
> xdebug.dump_once  On  On xdebug.dump_undefined    Off Off
> xdebug.extended_info  On  On xdebug.file_link_format  no value    no value
> xdebug.filename_format    no value    no value
> xdebug.force_display_errors   Off Off xdebug.force_error_reporting    0   0
> xdebug.halt_level 0   0 xdebug.idekey netbeans-xdebug netbeans-xdebug
> xdebug.max_nesting_level  256 256 xdebug.max_stack_frames -1  -1
> xdebug.overload_var_dump  2   2 xdebug.profiler_aggregate Off Off
> xdebug.profiler_append    Off Off xdebug.profiler_enable  Off Off
> xdebug.profiler_enable_trigger    Off Off
> xdebug.profiler_enable_trigger_value  no value    no value
> xdebug.profiler_output_dir    C:\Windows\Temp C:\Windows\Temp
> xdebug.profiler_output_name   cachegrind.out.%p   cachegrind.out.%p
> xdebug.remote_addr_header no value    no value
> xdebug.remote_autostart   Off Off xdebug.remote_connect_back  Off Off
> xdebug.remote_cookie_expire_time  3600    3600 xdebug.remote_enable   On  On
> xdebug.remote_handler dbgp    dbgp xdebug.remote_host 127.0.0.1   127.0.0.1
> xdebug.remote_log c:\xampp\php\logs\xdebug.log    c:\xampp\php\logs\xdebug.log
> xdebug.remote_mode    req req xdebug.remote_port  9000    9000
> xdebug.remote_timeout 200 200 xdebug.scream   Off Off
> xdebug.show_error_trace   Off Off xdebug.show_exception_trace Off Off
> xdebug.show_local_vars    Off Off xdebug.show_mem_delta   Off Off
> xdebug.trace_enable_trigger   Off Off
> xdebug.trace_enable_trigger_value no value    no value
> xdebug.trace_format   0   0 xdebug.trace_options  0   0
> xdebug.trace_output_dir   C:\xampp\tmp    C:\xampp\tmp
> xdebug.trace_output_name  trace.%c    trace.%c
> xdebug.var_display_max_children   128 128
> xdebug.var_display_max_data   512 512 xdebug.var_display_max_depth    3   3

在我的php.ini中我添加了以下内容

>  zend_extension = C:\xampp\php\ext\php_xdebug-2.6.0beta1-7.2-vc15.dll
> 
> xdebug.extended_info = on xdebug.remote_enable = 1
> xdebug.remote_handler = dbgp xdebug.remote_host = 127.0.0.1
> xdebug.remote_port = 9000 xdebug.remote_autostart = 0
> xdebug.remote_connect_back = 0 xdebug.trace_output_dir =
> "C:\xampp\tmp" xdebug.remote_log = "c:\xampp\php\logs\xdebug.log"
> xdebug.idekey=netbeans-xdebug

项目属性>运行配置我有以下设置

> Run As: Local Web Site 
> ProjectURL: http://localhost:9000/

在advended ...... 我有调试器代理:主机localhost端口:9000

在工具>选项> PHP>调试我有以下设置

> Debugger Port: 9000
> Session ID: netbeans-xdebug
> Maximum Data Length : 2048
> Show Requested URLs is checked

如果您需要更多信息,请与我们联系。

添加:在netbeans中,我可以看到我的请求进入我的网络监视器。 例如:

Request URL: chrome-extension://cajoopobkbcpiniljegibngikdbidbkh/special.js
Method: GET
Status: 200 OK

Request Headers
Referer: http://localhost/register.php?XDEBUG_SESSION_START=netbeans-xdebug
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36

Response Headers
Access-Control-Allow-Origin: *
cache-control: no-cache
Content-Security-Policy: script-src 'self' blob: filesystem: chrome-extension-resource:; object-src 'self' blob: filesystem:;
Content-Type: application/javascript
ETag: "9otsANv03nd8a+7S0vdszi+cI6E="

我在浏览器中的请求会一直挂起,直到我关闭进程"等待连接(netbeans-xdebug)"然后正常加载。

更多信息归功于skomisa留下的评论。

我运行netstat -o -n -a | findstr 127.0.0.1:9000 得到以下。显示netbeans没有听。

  TCP    127.0.0.1:9000         127.0.0.1:60365        ESTABLISHED     10700
  TCP    127.0.0.1:60365        127.0.0.1:9000         ESTABLISHED     10700 

我已卸载mcafee并关闭了windows defender。

1 个答案:

答案 0 :(得分:0)

有很多答案可以解决这个特殊问题。我想你还没有(重新)搜索过它。并且在调试代码时你犯了一些错误。为了解决这个问题,请遵循以下步骤。

您的X-Debug配置在php.ini文件中看起来是正确的。但是看看我对你的这个小修改。

zend_extension = C:\xampp\php\ext\php_xdebug-2.6.0beta1-7.2-vc15.dll
xdebug.extended_info = on
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = "localhost"  ; <-- "localhost" instead of 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_autostart = 0
;xdebug.remote_connect_back = 0
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.remote_log = "c:\xampp\php\logs\xdebug.log"
xdebug.idekey=netbeans-xdebug

在运行配置中,您需要设置项目网址,而不是http://localhost:9000/。端口号9000意味着XDebug的用途。因此,将运行配置更改为类似的内容,

http://localhost/<your_project_name>/index.php

现在请注意,

  1. 如果您使用xdebug.remote_host = "localhost",请尝试使用http://localhost其他http://127.0.0.1
  2. 如果您将Apache端口配置为其他端口而不是80,则应将该端口地址与localhost127.0.0.1一起附加。
相关问题