我知道这已被问到无数,因为我已经在论坛上搜索并阅读了这么多帖子。然而,看起来这里的失败是基于如此多的变量,解决方案对问题特别重要,并没有什么能真正解决我的问题。我觉得我需要你们所有经验丰富的球员的指导。
在NetBeans中:
加载我的本地沙箱项目后,我点击Debug Project,在Chrome中打开index.php页面,无论断点如何,代码都一直运行到最后,NetBeans挂起说“等待连接”(xdebug) )” ...
在上面,我可以看到:
aaron@aaron-aspire-v5:/var/log/apache2$ netstat -an | grep 9001
tcp6 0 0 :::9001 :::* LISTEN
在Vim :
://localhost/html/sandbox/index.php?XDEBUG_SESSION_START=netbeans-xdebug
waiting for a new connection on port 9001 for 10 seconds...
非常好。连接在vim中超时
在上述过程中,在超时之前,我可以看到:
aaron@aaron-aspire-v5:/var/log/apache2$ netstat -an | grep 9001
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN
我已经编辑了/etc/php5/cli/php.ini和/etc/php5/apache2/php.ini文件,并添加了以下内容:
的zend_extension = / usr / lib中/ PHP5 / 20121212 / xdebug.so xdebug.default_enable = 1 xdebug.remote_enable = 1 xdebug.remote_handler = dbgp xdebug.remote_mode =代表 xdebug.remote_host =本地主机 xdebug.remote_port = 9001 xdebug.remote_log = /无功/日志/ apache2的/ xdebug.log
phpinfo()现在返回有关xdebug的以下内容:
xdebug
xdebug support => enabled
Version => 2.2.5
IDE Key => aaron
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.idekey => no value => no value
xdebug.max_nesting_level => 100 => 100
xdebug.overload_var_dump => On => On
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_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => /var/log/apache2/xdebug.log => /var/log/apache2/xdebug.log
xdebug.remote_mode => rep => rep
xdebug.remote_port => 9001 => 9001
xdebug.scream => 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_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
let g:debuggerPort = 9001
已添加到我的.vimrc文件,php_value xdebug.remote_port 9001
已添加到我的apache2.conf文件中。非常感谢任何帮助!!提前谢谢。
答案 0 :(得分:0)
您未设置xdebug.idekey => no value
xdebug.idekey => no value => no value
也
xdebug.remote_autostart => Off => O
错了。
将其设为
; idekey can be just about anything, but the value in php.ini needs
; to match the value used in the environment that launches php.
xdebug.idekey=vim_session
和
; We have to turn on remote_autostart when running php from
; cli. That's probably a good reason to keep the cli and apache
; versions of php.ini distinct.
xdebug.remote_autostart=1
您应该会在屏幕底部看到waiting for a new connection on port 9000 for 5 seconds…
之类的消息。
现在有五秒钟刷新PHP页面。
这将在调试器和客户端之间创建连接。现在你正在调试。按照“帮助”窗口中的说明进入,跳过和退出代码。按F5运行代码,直到断点(您可以使用:BP设置)
还要看这个答案PHP debugger for Vim
<强>更新强>
让phpinfo再次运行,看看我提到的值现在是否正确?然后看看还在使用的其他php配置文件并查看内容。
让服务器在不同的端口上连接有点棘手。您需要为每个用户设置自定义php.ini值(xdebug.remote_port) 。如果您在Apache中使用VirtualHost,它最有效。只需将以下行添加到httpd.conf的 VirtualHost部分:
php_value xdebug.remote_port 9001
现在重启Apache,如果你使用那个VirtualHost和那个vi用户,那么他们应该成功连接。