Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

auto_prepend_file breaks xdebug

I am debugging PHP 5.2(i know it's old) with PHPStorm 2016.2, enter image description here

however when i add auto_prepend_file or auto_append_file in my apache vhost file:

enter image description here

    php_value auto_prepend_file /home/abc/def/apache_prepend.php
    php_value auto_append_file /home/abc/def/apache_append.php

xdebug breaks.

The IDE stops at the first breakpoint then the debugging stops when i try to step over/in/out and the browser returns "no data received".

My xdebug.conf file:

#[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
like image 461
max4ever Avatar asked Mar 13 '17 16:03

max4ever


1 Answers

The solution was to move the xdebug.conf at the end of the apache virtual host like this

        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>

p.s. Later i figured out that php_value xdebug.auto_trace off also fixed this bug without changing apache vhost.

like image 55
max4ever Avatar answered Nov 14 '22 03:11

max4ever