使用 NetBeans 调试 PHP?
更新 1:
我做了以下更改:
/etc/php5/apache2/conf.d/xdebug.ini
看起来像这样:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=On
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
phpinfo 看起来像这样:
debug
xdebug support enabled
Version 2.0.5
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 no value no value
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 localhost localhost
xdebug.remote_log no value no value
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
我已经检查了 netbeans tools >选项> php
设置,它们与下面第一个答案中所描述的一样。然后,我选择一个 if 语句,单击 ctrl+f8 添加换行符,我不确定下一步要做什么,因为大多数 debug
和 netbeans 中的 run
选项被禁用。
原始问题:
我已经尝试遵循许多指南,但我似乎无法在 netbeans 中进行 php 调试工作
我已经安装了 lamp stack、netbeans、xdebug、netbeans php 插件,并将以下内容添加到/etc/php5/apache2/conf.d/xdebug.ini
:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
如果我重新启动 apache2 并加载 netbeans 并打开一个 php 页面并添加断点,所有调试和运行选项在 netbeans 中被禁用...
我做错了什么?
我使用的是 ubuntu 10.04,所有内容都是通过标准 ubuntu 存储库安装的。
UPDATE 1:
I have made a change in:
/etc/php5/apache2/conf.d/xdebug.ini
looks like this:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=On
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
phpinfo looks like this:
debug
xdebug support enabled
Version 2.0.5
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 no value no value
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 localhost localhost
xdebug.remote_log no value no value
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
I have checked netbeans tools > options > php
settings and they are as they have been described in the first answer below. I then select an if statement, click ctrl+f8
an add a line break, and I am not sure what to do next, as most of the debug
and run
options in netbeans are disabled.
ORIGINAL QUESTION:
I have tried following many guides, but I can't seem to get php debugging in netbeans to work
I have installed lamp stack, netbeans, xdebug, netbeans php plugin, and added the following to /etc/php5/apache2/conf.d/xdebug.ini
:
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
If I then restart apache2 and load netbeans and open a php page and add a breakpoint, all the debug and run options are disabled in netbeans...
What am I doing wrong?
I am using ubuntu 10.04, and everything is installed via the standard ubuntu repositories.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 xdebug 设置看起来不错,尽管您可能需要添加另一行
并且您可能需要检查/更改 Netbeans 中的一些设置。转到“工具”-“选项”-“PHP”-“常规”,并验证调试器端口是否设置为 9000(与您的 xdebug 端口一样),并且会话 ID 设置为
netbeans-xdebug
您可以验证 xdebug 是否正在运行当您转到调用
phpinfo()
的页面并检查输出中的xdebug
时。Your xdebug settings seem fine, although you might need to add another line
And you probably need to check/change a few settings in Netbeans. Go to Tools - Options - PHP - General and verify that the debugger port is set to 9000 (as is your xdebug port) and the session id is set to
netbeans-xdebug
You can verify that xdebug is running when you go to a page that calls
phpinfo()
and check forxdebug
in the output.