【问题标题】:xdebug only gets triggered via running script from cli and not browserxdebug 只能通过从 cli 运行脚本而不是浏览器来触发
【发布时间】:2015-11-12 19:53:56
【问题描述】:

我有一个运行 apache2 php5 和 xdebug 的 Docker 容器。当我通过 docker 容器上的 root 从命令行运行 php 脚本时,我只能触发 xdebug。我得到一个包含以下条目的 xdebug 日志文件:

Log opened at 2015-11-12 19:34:30  
I: Checking remote connect back address.  
I: Checking header 'HTTP_X_FORWARDED_FOR'.  
I: Checking header 'REMOTE_ADDR'.  
W: Remote address not found, connecting to configured address/port: 192.168.9.12:9000. :-|  
I: Connected to client. :-)  

当我尝试通过浏览器和 XDEBUG_SESSION cookie 连接到一个简单的 hello world php 页面时,我没有收到来自 xdebug 的响应。我确实将页面发送回浏览器,但没有进入 xdebug 日志文件。

我想我可能有某种权限问题。 Apache 在 www-data 用户下运行,而脚本在 root 下运行。下面是我的 xdebug 配置:

xdebug  

xdebug support => enabled  
Version => 2.4.0beta1  
IDE Key => PHPSTORM  

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 => PHPSTORM => PHPSTORM  
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 => /tmp => /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 => On => On  
xdebug.remote_cookie_expire_time => 3600 => 3600  
xdebug.remote_enable => On => On  
xdebug.remote_handler => dbgp => dbgp  
xdebug.remote_host => 192.168.9.12 => localhost  
xdebug.remote_log => /xdebug.log => /xdebug.log  
xdebug.remote_mode => req => req  
xdebug.remote_port => 9000 => 9000  
xdebug.scream => Off => Off  
xdebug.show_error_trace => On => On  
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 => /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  

我还能做些什么来更好地调试它,我应该尝试任何其他 xdebug 设置吗?

谢谢,

沃伦

【问题讨论】:

    标签: php debugging docker xdebug


    【解决方案1】:

    对于任何感兴趣的人,错误的 php.ini 文件正在被修改。我盲目地修改/etc/php5/cli/php.ini 而不是/etc/php5/apache2/php.ini。我想知道路径中的“cli”是什么意思。

    谢谢,

    沃伦

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-16
      • 2014-05-25
      • 2014-04-13
      • 2016-05-25
      • 1970-01-01
      • 2014-08-20
      相关资源
      最近更新 更多