xdebug仅通过从cli运行脚本而不是浏览器

时间:2015-11-12 19:53:57

标签: php debugging docker xdebug

我有一个运行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设置吗?

谢谢,

沃伦

1 个答案:

答案 0 :(得分:0)

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

谢谢,

沃伦