DBGp remote server debugging

  • Tonari

    Tonari - 2011-06-18

    Hello everybody.
    I'm a php beginner trying to setup xdebug and DBGp for php debugging.
    I followed this tutorial (http://amiworks.co.in/talk/debugging-php-using-xdebug-and-notepad-part-i/) and had no problem in debugging locally.
    Now I would like to debug a site hosted on a remote machine.
    I'm developing on a 32 bit Windows 7 professional machine and the site is located in a Windows Server 2003 Standard Edition.
    I managed to install the Xdebug.dll on the server, however I'm not able to make the Notepad++ client and the server communicate.

    On my php.ini I added

    xdebug.profiler_output_dir = ""
    xdebug.profiler_output_name = "cachegrind.out.%p"
    xdebug.profiler_enable = 0

    On the DBGp config dialog screen in Notepad++ I entered the server IP address, an IDE key ("xdebug"), the remote path (like "\\myserver\d\htdocs\") and a local path (D:\htdocs\). "htdocs" is the folder where all the sites on the server are stored. Then I tried to debug my site adding the debug session name parameter (http://myserver.address.com/mysite/main.php?XDEBUG_SESSION_START=xdebug) but nothing seemed to happen.
    Now, clearly I'm doing something wrong and I searched the net for any tutorial on this issue, but I found only articles referring to local server debug setup (that is using Wamp, EasyPhp, etc).

    Could anyone please give me some advice or at least point me to a tutorial to resolve this problem?

    Thank you very much.

  • delbert

    delbert - 2011-06-28

    Im trying to get the same thing working, but still cant.

    Some things to note
    1. make sure port 9000 is open on the local machine and the remote web server. XDEBUG talks through this port.
    2. im not sure if your php.ini is correct.

    I think it should be the IP address of your local PC and not the localhost on the Web Server.

    The issue i am having is as follows.
    1. on the Web server the files are locally stored as C:/WebServer/php
    2. I map this as a network drive on my local machine I:/WebSever/php
    - so now i can see the actual files running on the web server.
    3. on my local machine i open the I:/WebServer/php files in Notepad++
    4. i setup DBGp with the followign config

    Remote IP = ip address of web server
    Remote Path = file:///C:/SVN_RELSRV/php
    Local path = I:/Webserver/php

    5. When i open web page with XDEBUG_START_SESSION set there is talk between Webserver and local Notepad++.
    However Notepad++ issues this error.

    "Unable to map I:\WebServer\php\index.php (IP 192……, idekey: xdebug)  unix=0"

    What i believe is happening is DBGp plugin is trying to map  I:/WebServer/php to information that is sent from remote web server ie.. file:///C:/WebServer/php and it cant.

    Anyone help?

  • Damjan Cvetko

    Damjan Cvetko - 2011-06-29


    Tonarij: Like derekwallace said, first thing wrong is the xdebug.remote_host in servers php.ini. This is where the webserver/php will connect to (N++ is actually doing the listening). Also the N++ needs to listen on port 9000, sometimes firewalls get in the way. Regarding mapping (as this is the source of endless confusion) let me just elaborate quick:
    Remote path is how the webserver/php see the paths (and send them to N++). So remote path in your case is D:\htdocs\ , but needs to be in a format of  file:///D:/htdocs/ . The local path is how N++ can find files, so in theory it could be \\myserver\d\htdocs\ but I think you'll get much better results by using drive mapping and doing something similar described by derekwallace ( I:\htdocs ).

    derekwallace: Whats actually happening to you here is that mapping of LOCAL to REMOTE fails. You probably set a breakpoint. What you need to change is your local path mapping to  I:\WebServer\php  (note the backslash and the case in path). Also your remote path strikes me strange it should be  file://C:/WebServer/php.

    To both of you, if you have no luck, press the DBG button and drop the debug here. From the XML it should be obvious what paths are being transferred back and forth.

    Best of luck!

  • delbert

    delbert - 2011-06-29

    Hi Zobo,

    Ive managed to get it to work.

    Remote Server:

    PHP file: C:\SVN_RELSRV\www_lib\html\index.php
    Ive shared the folder C:\SVN_RELSRV

    Local Machine

    Ive mounted I: as C:\SVN_RELSRV on Remote server.

    I open I:\www_lib\html\index.php in NP++

    I setup DBGp as follows.
    Remote Path : file:///C:/SVN_RELSRV/www_lib
    Local Path : I:\www_lib

    This also worked
    Remote Path : file:///C:/SVN_RELSRV
    Local Path : I:

    And so did this
    Remote Path : file:///C:/SVN_RELSRV/
    Local Path : I:\

    I tried a number of things that DIDNT work
    Remote Path : file:///C:/SVN_RELSRV
    Local Path : I:\
    - i believe issue here is the trailing slash in I:\ . There is no trailing slash in Remote Path

    Remote Path : file://C:/SVN_RELSRV
    Local Path : I:\
    - DBPp didnt like the file:// . It issues errors about not being able to map remote file

    Thx for replying .
    Great plugin!


  • Damjan Cvetko

    Damjan Cvetko - 2011-06-30


    Yap, the thing is damn sensitive to trailing slashes, when to use forward/backward slashes etc.

    Best of luck!

  • Tonari

    Tonari - 2011-08-03

    I am really sorry to answer so late (I thought I checked some kind of email alert, but I received nothing).

    Thank you Zobo!!

    But if xdebug.remote_host has to be the local machine IP address, this means that I can debug only on one machine at a time (the one I set on php.ini), right?

    Is it possible to do this from multiple machines (on which of course I would have installed N++ and the DBGp plugin)?

  • Anonymous - 2012-01-10

    Hi everybody,

    Is here someone who can decode from the log why N++ does quit connection right after it was initiated ?


    Server: Appache 2.2 on FreeBSD 8.2 as remote server
    N++: v5.9.8 UNICODE
    DBGp plugin: v0.0.12.121

    The log:

    Recv: <?xml version="1.0" encoding="iso-8859-1"?>
    <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///usr/local/www/apache22/data/index.php" language="PHP" protocol_version="1.0" appid="2328" idekey="devphp"><engine version="2.1.0"><![CDATA]></engine><author><![CDATA]></author><url><![CDATA]></url><copyright><![CDATA]></copyright></init>
    Send: source -i 1 -f file:///usr/local/www/apache22/data/index.php
    Send: feature_set -i 2 -n max_depth -v 3
    Send: feature_set -i 3 -n max_children -v 15
    Send: feature_set -i 4 -n max_data -v 512
    Send: breakpoint_list -i 5
    Send: step_into -i 6

    Recv: <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="source" transaction_id="1" encoding="base64"><![CDATA]></response>
    Recv: <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>
    Recv: <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>
    Recv: <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="max_data" success="1"></response>
    Recv: <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="5"></response>

    Recv: <?xml version="1.0" encoding="iso-8859-1"?>
    <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="6" status="stopping" reason="ok"></response>
    Send: run -i 7


    I took look into source and status="stopping" in response to _command="step_into" _ seems non handled properly but I not expert.

  • Anonymous - 2012-01-11

    Mistake was at server side. I have used extension=xdebug.so instead of zend_extension=xdebug.so. After the change reports status="break"


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks