在PhpStorm和Brew中启用Xdebug

时间:2016-05-17 17:52:20

标签: php xdebug

我在Mac上安装了带有brew的Php56。 使用PhpInfo(),我可以看到Xdebug,即使是php -m

[Zend Modules]
Xdebug

php --version

PHP 5.6.21 (cli) (built: Apr 29 2016 02:31:44)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans

使用

启动服务器Php
php -S 127.0.0.1:8080

并启用The icon with Phone但我的代码不会在断点处停止。

我尝试修改

/usr/local/etc/php/5.6/conf.d/ext-xdebug.ini

使用:

zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
xdebug.remote_autostart = 1
xdebug.remote_enable = 1

我甚至尝试验证调试器配置 enter image description here

我的Xdebug:

xdebug

xdebug support => enabled
Version => 2.4.0
IDE Key => bob

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.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.halt_level => 0 => 0
xdebug.idekey => no value => no value
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => On => On
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => On => On
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_enable_trigger_value => no value => no value
xdebug.profiler_output_dir => /var/tmp/ => /var/tmp/
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_addr_header => no value => no value
xdebug.remote_autostart => On => On
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 => 127.0.0.1 => 127.0.0.1
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.scream => Off => Off
xdebug.show_error_trace => 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_enable_trigger_value => no value => no value
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /var/tmp/ => /var/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

1 个答案:

答案 0 :(得分:0)

在浏览器中,Xdebug和PhpStorm将查找名为XDEBUG_SESSION的cookie,其值为PHPSTORM。

xdebug.remote_enable = 1
xdebug.remote_connect_back=1
#choose different port if nginx php-fpm used, because of nginx conf fastcgi_pass   127.0.0.1:9000;)
xdebug.remote_port = 9000
xdebug.idekey=PHPSTORM

之后使用此xdebug helper(不要忘记管理扩展,并更改IDE密钥选项)