为什么xdebug不与NetBeans建立连接?

ope*_*rog 8 php netbeans xdebug

我尝试使用xdebug和NetBeans来调试PHP.我开始调试,NetBeans等待与xdebug的连接.我有NetBeans 6.8(最新版本),我的mac上安装了最新的MAMP软件包.

我的php.ini看起来像这样:

[xdebug]
;zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
Run Code Online (Sandbox Code Playgroud)

ope*_*rog 10

最后,我必须像这样添加idekey值:

xdebug.idekey="netbeans-xdebug"
Run Code Online (Sandbox Code Playgroud)

现在它的工作原理:-)

  • 注意:我选择Pascal MARTIN的答案作为公认的答案,因为没有通过取消注释来启用xdebug,我的idekey事情无论如何都不会做任何事情;-)(除此之外我感觉不好接受我自己的答案所以我就是不这样做) (2认同)

Pas*_*TIN 9

如果你的php.ini看起来真的像你发布的那样,你必须取消注释该zend_extension(即删除;它的begninning),所以实际加载了Xdebug.

然后,确保加载Xdebug,phpinfo()从PHP文件调用(只是为了确定).

之后:我想应该有一些选项来配置netbeans中的调试器?如果是这样,netbeans是否正在侦听端口9000?(你在php.ini中配置的那个)

  • 你必须至少重启Apache(在Apache启动时才考虑对php.ini的修改); 对于会话ID,有一个xdebug.idekey设置(参见http://xdebug.org/docs/remote); 不确定它会做什么,但它可能 - 永远不会记得已经设置,但; 我想Eclipse PDT的默认值很好(我通常使用eclipse PDT,而不是netbeans) (2认同)

Mar*_*man 6

重启Apache后,以下设置适用于Mountain Lion上的NetBeans 7.2:

zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.remote_autostart=on 
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug" 
Run Code Online (Sandbox Code Playgroud)