8

I have Xdebug 2.1 installed, and running with PHP 5.2.13. It can successfully connect to multiple DBGP clients (i.e. the xdebug.remote_log shows communication back and forth, and the clients themselves also show the incoming connection), but it doesn't stop at breakpoints. I have tried NetBeans, MacGDBp and also the command-line debugclient bundled with Xdebug.

A typical exchange looks like:

Log opened at 2010-07-20 09:33:17
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/hgfs/htdocs/mycompany/index.php" language="PHP" protocol_version="1.0" appid="14371" idekey="macgdbp"><engine version="2.1.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2010 by Derick Rethans]]></copyright></init>

<- status -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="macgdbp" status="starting" reason="ok"></response>

<- step_into -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="macgdbp" status="stopping" reason="ok"></response>

<- status -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="macgdbp" status="stopping" reason="ok"></response>

Log closed at 2010-07-20 09:33:18

NetBeans attempts to set breakpoints, and these are acknowledged by Xdebug:

<- breakpoint_set -i 7 -t line -s enabled -f file:///mnt/hgfs/htdocs/mycompany/index.php -n 9
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="7" state="enabled" id="139360004"></response>

However, Xdebug still refuses to stop!

mjs
  • 63,493
  • 27
  • 91
  • 122

6 Answers6

11

This appears to happen if you have have Xdebug loaded as an extension (i.e. extension=xdebug.so) in the PHP config instead of a zend_extension (i.e. zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so).

Make sure that you don't have an extension=xdebug.so line anywhere in your PHP config, even if you're pretty sure you're using zend_extension. For example, if you have zend_extension in /etc/php5/conf.d/xdebug.ini, this may well be superseded by an extension in /etc/php5/apache2/php.ini. If this is the case, nothing will complain, and phpinfo() will dutifully report that Xdebug is loaded! (Xdebug 2.1 does issue a small warning in phpinfo() when loaded as an extension, but previous versions do nothing.)

mjs
  • 63,493
  • 27
  • 91
  • 122
  • Wow, this really saved me after getting some weird behavior configuring remote debugging with MacGDBP. I could see that connections were successful in the xdebug.remote_log, and the client was receiving connections, but connections were quickly being dropped. There was no output in the client either. Changed "extension=xdebug.so" as you suggested and boom everything works beautifully. – milesw May 14 '13 at 10:59
  • You sir made my day. If I could, I would upvote a thousand times. – Bgi Jun 08 '13 at 15:40
2

I had this problem on Docker container on Windows. All seemed properly configured, phpStorm properly listening on local port 9000 on 127.0.0.1. phpinfo() displayed the xdebug.so running. When I run the script from the web browser, the debugger failed to stop on the breakopint. The xdebug.log contained this:

Log opened at 2019-07-02 08:17:10
I: Connecting to configured address/port: docker.for.mac.localhost:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///app/www/index.php" language="PHP" xdebug:language_version="7.2.15" protocol_version="1.0" appid="38768" idekey="PHPSTORM"><engine version="2.6.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2018 by Derick Rethans]]></copyright></init>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Log closed at 2019-07-02 08:17:10 

I had to ssh into the container to find out that it wasn't connecting out from the container to the Windows, which hosted the container. The problem was, that my docker compose configuration contained docker.for.mac.localhost which was about to be set into the xdebug.remote_host setting. Even if the xdebug.log claimed xdebug connected to the client, in fact it didn't connect.

The solution was xdebug.remote_host = host.docker.internal. This hostname is used in Docker container to make a local connection to the operating system which is hosting the container.

More info here: https://docs.docker.com/docker-for-mac/networking/

digitalstraw
  • 403
  • 3
  • 7
  • Finally!!! After days of trying to figure out the issue! My issue was that I had xdebug.discover_client_host enabled and I did not specify xdebug.client_host. I disabled discover_client_host and set client_host=host.docker.internal. – techcase May 06 '21 at 14:38
1

If php files are placed into symlink-folder then XDebug will operate with source folder path instead of symlink-folder path!

So to enable breakpoints you should configure path mappings in your ide for symlinked folders and files

AndreyP
  • 2,510
  • 1
  • 29
  • 17
0

You must add the full path to the xdebug.so file, even when it's placed in the php/modules/ folder, as zend_extension doesn't looks in this folder by default.

If you have an exension=xdebug.so line, xdebug will load but it won't stop at breakpoints (beats me why).

Removing all exension=xdeabug.so (even from the cli ini file, which also loads) and adding the zend_extension will solve the issue.

Wouter J
  • 41,455
  • 15
  • 107
  • 112
maxidirienzo
  • 99
  • 1
  • 6
  • 1
    this just repeat everything that's said by @mjs... An answer to a question which is 2 years old should be better than this. – Wouter J Apr 02 '13 at 19:56
  • I was just clarifying that you must use the full path, he says "zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so" but I assumed he used this path because he had a compiled version there or whatever, as I put the xdebug.so in the php/modules folder I didn't put the full path (as you do with the "extension" directive) and that didn't work. – maxidirienzo Apr 03 '13 at 12:50
0

I know that this has been answered but I came across the same issue just want to offer my answer if anyone else runs across this. I accidentally missed a case value in my paths which still allowed me to connect and run the debugger but it wouldn't stop at my breakpoints. I didn't realized it till much frustration so I just want people to know that that could be a possibility as well.

Cody
  • 578
  • 3
  • 13
0

In my case, Eclipse can't pick up the debug info, so enable xdebug log and check the response, returned <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response> with no more info.

Fix is to change debug configure

xdebug.remote_host=127.0.0.1 to
xdebug.remote_host=localhost

in /usr/local/etc/php/5.6/php.ini

then restart Apache.

Hope this helps

  • Hey, I am also getting the same in the xdebug logs. But your solution is not working for me. I am using Netbeans and Code is in Remotehost Cent OS 7. Any help would be appreciated. – Gireesh Doddipalli Nov 24 '21 at 06:20