xdebug remote debugging won't stop at breakpoints

42,772

Solution 1

I had this problem and took me ages to find the answer.

In your debug config, in the server area, click Configure, go to Path Mapping, click the path that's there and click edit, change to Path in file system and navigate to the correct file.

Done.

Solution 2

I had the same problem, and finally I found that my php.ini was missing these two important settings:

xdebug.remote_autostart = "On"
xdebug.remote_enable = "On"

Then it worked perfectly.

Solution 3

XDebug works fine in my Ubuntu Lucid box using NetBeans, and i do have the zend_extension line in my php.ini (/etc/php5/apache2/php.ini).

I'm using netbeans 6.9 and PHP 5.2 with xdebug 2.0.4-2

I'm pasting the relevant lines here, hope it helps:

zend_extension=/usr/lib/php5/20060613/xdebug.so

[debug]
; Remote settings
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"

; General
xdebug.auto_trace=off
xdebug.collect_includes=on
xdebug.collect_params=off
xdebug.collect_return=off
xdebug.default_enable=on
xdebug.extended_info=1
xdebug.manual_url=http://www.php.net
xdebug.show_local_vars=1
xdebug.show_mem_delta=0
xdebug.max_nesting_level=100
;xdebug.idekey=

; Trace options
xdebug.trace_format=0
xdebug.trace_output_dir=/tmp
xdebug.trace_options=0
xdebug.trace_output_name=crc32

; Profiling
xdebug.profiler_append=0
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_dir=/tmp
xdebug.profiler_output_name=crc32

Solution 4

from http://xdebug.org/docs/install , "You should ignore any prompts to add "extension=xdebug.so" to php.ini — this will cause problems."

so, this fixed it for me :

in the config file , where you load the xdebug extension ( for me , for the CLI version of php , that was /etc/php5/cli/conf.d/xdebug.ini ) - dont specify

extension=xdebug.so

instead , use

zend_extension=/path/to/xdebug/module/xdebug.so

( for me , this was something like /usr/lib/php5/(...)/xdebug.so )

Use locate xdebug.so to find the location.

Solution 5

I have had the same issue, the solution for me was to have the local code on the same path as the remote code.

Example

On the webserver the code was located on the path: /var/www/dev01/app_name

Locally the code was located in my home directory: /home/me/projects/app_name

This configuration caused my IDE (Eclipse and Komodo) to fly straight past the breakpoints.

Changing the local path from /home/me/projects/app_name to /var/www/dev01/app_name fixed the issue. Using sshfs to locally mount the remote filesystem makes it even easier.

Share:
42,772
learner
Author by

learner

I'm a web developer who writes PHP / Zend Framework apps by day and Rails apps by night. I'm also a CSS ninja and javascript dabbler. If I'm not programming a site, I'm probably working on IA charts on UI design. I like to bring order out of chaos.

Updated on July 09, 2022

Comments

  • learner
    learner almost 2 years

    I'm having a problem with xdebug not stopping at breakpoints when using remote debugging (everything is fine when running scripts via the command line). It will break at the first line of the program, then exit, not catching any breakpoints.

    It used to work fine, until I switched over to using MacPorts for Apache and PHP. I've tried re-compiling it several times (with several versions), but no dice.

    I'm using PHP 5.3.1 and Xdebug 2.1.0-beta3

    I've also tried at least 3 different debugging programs (MacGDBp, Netbeans and JetBrains Web IDE).

    My php.ini settings look like:

    [xdebug]
    xdebug.remote_enable=1
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_port=9000
    xdebug.remote_host=localhost
    xdebug.idekey=webide
    

    And when I log the debugger output, setting a breakpoint looks like this/;

    <- breakpoint_set -i 895 -t line -f file:///Users/WM_imac/Sites/wm/debug_test.php -n 13 -s enabled -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="895" state="enabled" id="890660002"></response>

    When run, the debugger will get the context of the first line of the application, then send the detach and stop messages.

    However, this line is output when starting the debugger.

    <- feature_get -i 885 -n breakpoint_types -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="885" feature_name="breakpoint_types" supported="1"><![CDATA[line conditional call return exception]]></response>

    Does 'line conditional call return exception' mean anything?

    • learner
      learner about 14 years
      Further research reveals that 'line conditional call return exception' is a list of supported breakpoints, not any sort of error message.
    • learner
      learner about 14 years
      calling xdebug_break(); in my code will properly cause the debugger to stop.
    • DrDol
      DrDol almost 14 years
      Can you specify the path to your php.ini file. Are you using HTTPS for this host?
    • learner
      learner almost 14 years
      Using regular http, with ini file at /opt/local/etc/php5/php.ini (default location for MacPorts install)
    • learner
      learner over 13 years
      After having this problem a very long time, it seems to have been resolved by a) upgrading from Leopard to Snow Leopard (which reinstalls much of the unix system in OS X) and b) completely re-installing my dev environment via MacPorts.
    • Adrian
      Adrian over 8 years
      Not seen this one here... so : using xdebug.remote_connect_back = 1 fixed it for me ; while this leaves your server open to everyone to debug, that's fine when it's a VM on your local machine. I think xdebug.remote_host = is the key to doing this more specifically and limiting it to your workstation. And restarting Apache when you change settings...
  • learner
    learner about 14 years
    I already am using zend_extension. Thanks for the insight, though.
  • learner
    learner about 14 years
    Full log output here: pastie.org/866632. The debugger stopped on the first line, and ignored all other breakpoints.
  • ksafonov
    ksafonov about 14 years
    Logs show that IDE is trying to put breakpoint to the file '/Users/WM_imac/Sites/wm/debug_test.php'. Does such a file exist, or real debug_test.php has different location?
  • Max Jacobson
    Max Jacobson almost 14 years
    Are you sure there isn't an extension=xdebug.so somewhere in the PHP configuration? I had both extension=xdebug.so and zend_extension=/path/to/xdebug.so and for some reason it was taking extension=xdebug.so, which loads the extension, but breakpoints don't work.
  • learner
    learner almost 14 years
    I double checked. Only using zend_extenstion. Again, the problem here is with breakpoints when running through a web browser. Everything works normally with CLI scripts or PHPUnit.
  • Oddthinking
    Oddthinking over 13 years
    I'm sure it is just a typo on SO, but check the spelling of "zend_extension" in the PHP file - it would be a shame it that was the cause.
  • Delirium tremens
    Delirium tremens over 13 years
    I hope showing this contradiction helps. serverfault.com/questions/202959/…
  • Steven
    Steven over 11 years
    Thanks for this! The web root definition fix the exact same problem for me.
  • e-motiv
    e-motiv over 11 years
    That worked for me too. Apparently, my previous, though not wrong Path mapping was relative to a linked folder. (Feels like a bug to me.)
  • brez
    brez over 10 years
    I ran into this as well - the top voted solution worked but presumably the UI has changed ? I did Preference/Paths and then set both the Local and Remote path to the same project directory and it starting work on breakpoints in the Test file. Presumably related to how PHPUnit runs the actual test (starting a new process?).
  • Bradley
    Bradley about 10 years
    This worked great, remember to restart apache after changing. The _autostart flag was it for me.
  • JJ Roman
    JJ Roman almost 9 years
    looks like I am experiencing same problem. In call stack I can see reference to file location on remote server. My problem thought is ... I am trying to debug on windows my code running on Linux. Is there any generic solution?
  • JJ Roman
    JJ Roman almost 9 years
    Just bare in mind you need to specify path on the server filesystem rather than web url so for instance: /var/www/html needs to be maped to C:\myworkspace\projectx etc
  • safl
    safl almost 9 years
    @JJRoman I have not tried it in a mixed environment. Perhaps the "Path Mapping" answer from pitchandtone will work for you.
  • pgr
    pgr about 8 years
    Beware the profiler, I had a system slow down terribly and then crash due to filling up the disk with huge files in /tmp, iut was cuased by the XDEBUG profiler...
  • Ryan
    Ryan almost 7 years
    For me, the problem was that Server Path was set to ~/Code/mysite, and I guess the ~ isn't honored, so I needed to change it to /home/vagrant/Code/mysite. This took me days to figure out. Ugh.
  • Larry B.
    Larry B. over 5 years
    Watch out for symlinks, too! If you are using PHP links in the apache directory, xdebug will resolve the link and will refer to the linked file instead of the link. So, even if you set up an Apache directive to /var/www/my_php/linkedFile.php, if that link resolves to /tmp/src/linkedFile.php for some reason, you should set up your path mapping to /tmp/src and not /var/www/my_php
  • frazras
    frazras about 3 years
    xdebug.mode = debug xdebug.start_with_request=yes in Xdebug 3