auto_prepend_file打破xdebug

max*_*ver 15 php xdebug phpstorm

我用PHPStorm 2016.2调试PHP 5.2(我知道它已经老了), 在此输入图像描述

但是当我在我的apache vhost文件中添加auto_prepend_fileauto_append_file时:

在此输入图像描述

    php_value auto_prepend_file /home/abc/def/apache_prepend.php
    php_value auto_append_file /home/abc/def/apache_append.php
Run Code Online (Sandbox Code Playgroud)

xdebug休息.

IDE在第一个断点处停止,然后当我尝试跳过/进入/退出并且浏览器返回"没有收到数据"时调试停止.

我的xdebug.conf文件:

#[xdebug]
php_value xdebug.remote_enable on
#php_value xdebug.default_enable on
php_value xdebug.remote_autostart off
php_value xdebug.remote_port 9000
php_value xdebug.remote_host 192.168.100.66
php_value xdebug.profiler_enable 0
php_value xdebug.profiler_enable_trigger 1
php_value xdebug.profiler_output_name cachegrind.out-%H-%R-%t
php_value xdebug.profiler_output_dir /home/abc/xdebug-profile
php_value xdebug.trace_enable_trigger 1   
#php_value xdebug.auto_trace off
php_value xdebug.trace_output_name trace.out-%H-%R-%t
php_value xdebug.trace_format 1
php_value xdebug.idekey PHPSTORM
Run Code Online (Sandbox Code Playgroud)

max*_*ver 2

解决方案是将xdebug.conf移动到 apache 虚拟主机的末尾,如下所示

        SetEnv ENVIRONMENT dev
        php_value auto_prepend_file /home/abc/prepends/apache_prepend.php
        php_value auto_append_file /home/abc/apache_append.php

        #INCLUDE XDEBUG AT THE END 
        Include /home/abc/projects/hello/site/vhosts/xdebug_notrace.conf

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

ps 后来我发现php_value xdebug.auto_trace off 也修复了这个错误,而无需更改 apache vhost。

  • 获得答案并避免发放赏金的好方法:D干得好。 (2认同)