等待连接(netbeans-xdebug)MAMP OS X [英] Waiting For Connection (netbeans-xdebug) MAMP OS X

查看:134
本文介绍了等待连接(netbeans-xdebug)MAMP OS X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

序言

许多小时后,我无法使NetBeans连接到xdebug.几个月前,在从旧版本的MAMP升级到MAMP PRO之后,调试完美进行了.一个星期前,它开始变得胡麻.它似乎可以连接,但不会在断点处停止.重新启动NetBeans(v7.0.1)和apache有时会使它在短时间内工作.

After many hours, I have been unable to get NetBeans to connect to xdebug. Some months ago, after upgrading from an old version of MAMP to MAMP PRO, debugging worked flawlessly. A week ago it started getting flakey. It would appear to connect but would not stop at the breakpoints. Restarting NetBeans (v7.0.1) and apache sometimes got it working for a short time.

我真的需要修复它,所以我安装了最新版本的MAMP PRO(2.1.2).现在,我永远收到等待连接"消息.

I really needed it fixed so I installed the latest version of MAMP PRO (2.1.2). Now I get the Waiting For Connection message forever.

我已经完成测试

在移动栏上出现正在等待连接"消息时,我看一下它是否在监听.是...

While the Waiting For Connection message is there with the moving bar, I look to see if it’s listening. It is...

# lsof -i -n -P |grep 9001
java  6496  tim  230u  IPv6 0xffffff80239d8190      0t0    TCP *:9001 (LISTEN)

在NetBeans php配置中,我将解释器设置为: /Applications/MAMP/bin/php/php5.4.10/bin/php

In NetBeans php config I have the interpreter set to: /Applications/MAMP/bin/php/php5.4.10/bin/php

执行以下操作:

# /Applications/MAMP/bin/php/php5.4.10/bin/php -i | grep xdebug

告诉我xdebug与phpinfo()一样正在运行

tells me that xdebug is running as does phpinfo()

我(多次)确认我到处都具有相同的端口号.我已经尝试过端口9000和9001.

I have (many times) confirmed that I have the port number the same everywhere. I have tried port 9000 and 9001.

xdebug.log 上做一个尾巴,然后从浏览器启动会话而不在NetBeans中启动调试会话会产生:

Doing a tail on xdebug.log then initiating a session from the browser without starting a debug session in NetBeans produces:

I: Connecting to configured address/port: localhost:9001.
E: Could not connect to client. :-(

等待连接消息 并从浏览器启动会话,我在日志中得到了此消息:

With the waiting for connection message and initiating a session from the browser, I get this in the log:

: Connecting to configured address/port: localhost:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/tim/MAMPSites/facts.tvd.us/htdocs/sendfile/tim.php" language="PHP" protocol_version="1.0" appid="7279" idekey="netbeans-xdebug"><engine version="2.2.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>

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

我的php.ini文件具有以下内容:

My php.ini file has the following:

[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.3.20/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9001
xdebug.idekey="netbeans-xdebug"

更新

我刚刚注意到上面的lsof命令显示了NetBeans在ipV6上侦听.强制Java(NetBeans)使用ipV4没有帮助.

I just noticed that the lsof command above shows NetBeans listening on ipV6. Forcing java (NetBeans) to use ipV4 does not help.

launchctl setenv JAVA_TOOL_OPTIONS -Djava.net.preferIPv4Stack=true

我找到了一条帖子,该帖子建议进行测试以确认xdebug正常运行.创建一个php文件:

I found a post that suggested a test to confirm xdebug is working correctly. Create a php file:

<?php
$address = '127.0.0.1';
$port = 9000;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $port) or die('Unable to bind');
socket_listen($sock);
$client = socket_accept($sock);
echo "connection established: $client";
socket_close($client);
socket_close($sock);
?>

从命令行运行它,并在浏览器中的url末尾加载以下内容:

Run it from the command line and load any page in your browser with the following at the end of the url:

?XDEBUG_SESSION_START=nb

如果输出类似已建立连接:资源ID#5"的信息,则xdebug正常工作.这样,我重新安装了Java和NetBeans.我告诉NetBeans不要导入我现有的首选项...仍然没有连接.

If it outputs something like "connection established: Resource id #5", xdebug is working correctly. With that, I reinstalled Java and NetBeans. I told NetBeans NOT to import my existing preferences... Still no connection.

Update2

我安装了Mac的phpStorm IDE.我已经学到了足够的知识,可以使调试器与现有的MAMP和xdebug设置一起运行.我认为这证实了NetBeans的问题.

I installed the phpStorm IDE for Mac. I learned enough about it to get the debugger running with my existing MAMP and xdebug setup. I think this confirms the problem is with NetBeans.

在这一点上,使这项工作似乎是不可能的. :(

At this point, getting this working seems impossible. :(

推荐答案

我问了同样的事情,并得到了很好的答案:如何跟踪PHP中每行/每行/每个方法块的执行时间?,除此之外,对于当前正在运行的具有相同内容的其他问题,我也有此答案.

I asked the same thing and got this quite good answer: How to track execution time of each line / block of lines / methods in PHP?, beside that i have this answer also on a currently running other question with the same content.

关于此的一些附加说明(我在自己的研究中针对此问题在其他SO帖子中收集的资料):

Some additional notes on that (stuff i've collected in other SO posts in my own research with this problem):

  1. 港口也可能是9001(似乎可以为某些人服务,而9000则不能.)
  2. 切换到PHPStorm IDE是解决此问题的真正替代方法(因为PHPStorm已经包含了可以完美运行的xdebug).
  3. 通过向导下载xdebug的新版本( http://xdebug.org/wizard.php),如果您按照说明进行操作,也许您会很幸运.
  4. 关闭防火墙可能会有所帮助.
  5. 添加到php.ini:xdebug.idekey=netbeans-xdebug.
  6. 找出是否有xdebug.ini文件,并将与xdebug相关的php.ini行添加到该文件中.
  7. 您必须取消注释zend_extension行(即,删除;开头的内容),以便实际上已加载Xdebug.
  8. 确保已加载Xdebug,并从PHP文件中调用phpinfo()(请确定).
  1. The port might be also 9001 (seems to work for some people while 9000 don't).
  2. Switching to PHPStorm IDE is a real alternative that solves this problem (as PHPStorm has included perfectly running xdebug already).
  3. Download a new version of xdebug via the wizard (http://xdebug.org/wizard.php) and if you follow the instructions maybe you will be lucky.
  4. Switching off the firewall might help.
  5. Add to php.ini: xdebug.idekey=netbeans-xdebug.
  6. Find out if you have a xdebug.ini file and add the xdebug related php.ini lines to that file.
  7. you have to un-comment the zend_extension line (i.e. remove the ; at its begninning), so Xdebug is actually loaded.
  8. make sure Xdebug is loaded, calling phpinfo() from a PHP file (just to be sure).

这篇关于等待连接(netbeans-xdebug)MAMP OS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆