xDebug 似乎安装正常,但无法与 NetBeans 连接
我现在已经尝试了几个小时让 xDebug(从源代码编译的 2.0.5)在装有 NetBeans 6.8 的 MacBook OS X 上运行。我已经安装了 MAMP 并正在用它运行一个小型 PHP (5.2) 测试程序,没有问题。但是,当我尝试调试时,我在 Netbeans 中收到以下文本:“等待连接 (netbeans-xdebug)”,然后什么也没有发生。 Netbeans 配置为调试器端口 9000。MAMP 中没有 Zend 优化。
我已经遵循了: http://netbeans .org/kb/docs/php/configure-php-environment-mac-os.html#installEnableXdebug 和 http://www.xdebug.org/docs/install 和 http://forums.netbeans.org/topic1513-0-asc-0 .html 等
这是我的 php.ini 的一部分,
[XDebug]
;zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
;[Zend]
;zend_optimizer.optimization_level=15
;zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.9
;zend_optimizer.version=3.3.9
; Xdebug config for Mac OS X and NetBeans IDE
zend_extension=/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
我已经阅读了很多安装说明等,并且 phpinfo 显示 xDebug 已安装为 V.5.2.11(通过 MAMP 中的“打开起始页”查看)。但是,当我在终端 PHP -mi 中尝试时,没有看到 xdebug 列出。我最后发现 PHP.INI 是从 /etc 读取的,所以我将 MAMP php.ini 复制到那里的 php.ini,从而在那里添加了 xdebug.se、localhost、端口 9000 等信息。之后,当我执行 PHP -m 时也会列出 xdebug,但我仍然遇到 NetBeans 问题。奇怪的是 php -i 显示版本 5.2.10,而不是上面的 5.2.11!
我也尝试过这个,为 idekey 添加“netbeans-xdebug”: 为什么xdebug 没有与 NetBeans 建立连接吗?
为什么 PHP_INFO() 似乎在 ../MAMP/... 下找到了我的 PHP.INI 文件,而不是在从 /etc 读取时执行 PMP -m 时找到它?
如何让 PHP 始终在 MAMP 下找到 INI 文件,这样我就不必使用两个 PHP.INI 文件来让 PHPINFO() 和 PHP -m 工作?
既然 xDebug 似乎已正确安装,但在 NetBeans 中仍然无法工作,我该如何解决 NetBeans 问题?需要双 php.ini 吗?我可能编译了 xdebug 错误吗?如何知道? xdebug / php 中有 php 版本吗?如何检查?
这是 php -i 结果的一部分:
xdebug
xdebug support => enabled
Version => 2.0.4
Supported protocols => Revision
DBGp - Common DeBuGger Protocol => $Revision: 1.125.2.6 $
GDB - GNU Debugger protocol => $Revision: 1.87 $
PHP3 - PHP 3 Debugger protocol => $Revision: 1.22 $
Directive => Local Value => Master Value
xdebug.auto_trace => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
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.idekey => pettermagnusson => netbeans-xdebug
xdebug.manual_url => http://www.php.net => http://www.php.net
xdebug.max_nesting_level => 100 => 100
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => Off => Off
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 127.0.0.1 => 127.0.0.1
xdebug.remote_log => /tmp/xdebug.log => /tmp/xdebug.log
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /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
Rgds 下午
I have now tried for hours getting xDebug (2.0.5 compiled from source) to work on my MacBook OS X with NetBeans 6.8. I have installed MAMP and am running a small PHP (5.2) test program with it, no problem. But when I try to debug I get this text in Netbeans: "Waiting for connection (netbeans-xdebug)" and nothing more happens. Netbeans is configured for Debugger Port 9000. No Zend Optimization in MAMP.
I have followed this: http://netbeans.org/kb/docs/php/configure-php-environment-mac-os.html#installEnableXdebug
and http://www.xdebug.org/docs/install
and http://forums.netbeans.org/topic1513-0-asc-0.html etc
Here is part of my php.ini
[XDebug]
;zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
;[Zend]
;zend_optimizer.optimization_level=15
;zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.9
;zend_optimizer.version=3.3.9
; Xdebug config for Mac OS X and NetBeans IDE
zend_extension=/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
I have read a lot of installation instructions etc and phpinfo show that xDebug is installed OK as V.5.2.11 (seen via "Open Start Page" in MAMP). However when i try in terminal PHP -m i do not see xdebug listed. I finally figured that PHP.INI is read from /etc so I copied the MAMP php.ini to php.ini there, thus added the xdebug.se, localhost, port 9000 etc info there. After that xdebug IS listed when I do PHP -m too, but I STILL get the NetBeans problem. Strange enough php -i shows version 5.2.10, not 5.2.11 as above!
I also tried this, adding the "netbeans-xdebug" for idekey: Why does xdebug not establish connection with NetBeans?
How come PHP_INFO() seemed to find my PHP.INI file under ../MAMP/... and not when doing PMP -m when it is read from /etc ?
How can I get PHP to always find the INI file under MAMP so I dont have to use two PHP.INI files to et PHPINFO() and PHP -m to work?
How can I resolve the NetBeans problem now that xDebug seems to be installed correctly but still not working in NetBeans? Something with this need for dual php.ini? Could I have compiled xdebug wrong, how to know? Something with php versions in xdebug / php? How to check?
Here is a part of the result from php -i:
xdebug
xdebug support => enabled
Version => 2.0.4
Supported protocols => Revision
DBGp - Common DeBuGger Protocol => $Revision: 1.125.2.6 $
GDB - GNU Debugger protocol => $Revision: 1.87 $
PHP3 - PHP 3 Debugger protocol => $Revision: 1.22 $
Directive => Local Value => Master Value
xdebug.auto_trace => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
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.idekey => pettermagnusson => netbeans-xdebug
xdebug.manual_url => http://www.php.net => http://www.php.net
xdebug.max_nesting_level => 100 => 100
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => Off => Off
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 127.0.0.1 => 127.0.0.1
xdebug.remote_log => /tmp/xdebug.log => /tmp/xdebug.log
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /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
Rgds
PM
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
phpinfo()
使用 MAMP 的 PHP 二进制文件,而 CLI 使用您的操作系统二进制文件。保持 PHP 操作系统不变,这样您就不会在升级时遇到问题,并根据需要调整使用 MAMP 冒泡的操作系统。
下载最新版本的 MAMP,其中包含已编译的 xdebug 扩展,并将其添加到您的
php.ini
中。我使用端口 9001,因为 OSX 似乎不喜欢默认端口。
phpinfo()
uses MAMP's PHP binary, while CLI uses your OS one.Leave the OS PHP untouched so you don't have problem upgrading and tweak the one bubled with MAMP as you need.
Download the latest version of MAMP which includes xdebug extension compiled and add this to your
php.ini
.I use port 9001 as OSX doesn't seem to like the default.
我从 Komodo 下载了错误的 xDebug.so,而且我自己的构建也不好。再次下载,现在已经OK了。哇,这花了我很多小时,而且也没有人能帮忙!
/下午
I downloaded the wrong xDebug.so from Komodo and somehow also my own build was no good. Downloaded again and now its OK. Wow, this took me MANY hours, and no one could help either!
/PM
我检查并重新检查了所有设置和设置说明,但 XDebug 仍然不起作用。最后我重新启动了 Mac,它神奇地开始工作了。也许这会对与我处境相同的人有所帮助。
I checked and re-checked all the settings and setup instructions and still it appeared that XDebug didn't work. In the end I restarted my Mac and it magically started working. Maybe this will help someone in the same position as me.
这对我有用
brew install php55-xdebug
获取ini路径,然后将以下内容粘贴到最后
<代码> php -i | grep '配置文件'
vim /usr/local/etc/php/5.5/php.ini
添加以下内容
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_autostart=1
This is what working for me
brew install php55-xdebug
grab the ini path, then paste the following to the last
php -i | grep 'Configuration File'
vim /usr/local/etc/php/5.5/php.ini
add the following
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_autostart=1