Path Mapping In PHP Debugger

In this entry I would like to announce manual Path Mapping for remote debugging. Since NB6.5 it has been possible to debug both scripts and web pages, and web pages can be debugged either Locally or Remotely. For Remote Debugging, unfortunately the debugged php file on the remote server isn't the same as the file opened in NetBeans IDE running on a local machine. Debugger support in NetBeans must thus be able to map server paths to local paths, take into account that the server and client might run on different OS platform, cannot rely that the initially debugged file is really the debugged one because of rewrite rules, prepend files... Many more factors could be mentioned here but it means that path mapping cannot be resolved automatically for every individual scenario. That's the reason why for 6.7 we added the possibility to manually define path mapping through project setup for individual run configurations. In the next screenshot is a declaration for mapping from a Windows server path to a Linux local path. 

Path Mapping Customization

Together with manual path mapping, two additional choices were added. The first one, "Ask Every Time," lets you choose the URL yourself just before the debugging session is started (see next screenshot). The second one, "Do Not Open Web Browser," only starts the debugging session and expects you to open your web browser and browse the URL yourself - anyway GET (or POST) variable XDEBUG_SESSION_START is needed.

Ask For Ever For URL


Nice, I have been waiting for this feature, without it I can't debug anything because most libraries that we use are installed server wide.
Does this also mean that I can debug an arbitrary URL instead of an existing PHP file that must be inside the project directory (this was the case in previous versions of Netbeans that I have used)?

Posted by Joris on April 03, 2009 at 01:48 AM CEST #

You are supposed to start debugging from page(URL) mapped to arbitrary file inside of your project, the following pages doesn't need to be from inside project but then you need to ensure manually path mapping because these won't be mapped automatically which is also true for files in include path

Posted by rmatous on April 03, 2009 at 03:58 AM CEST #

Nice, now we can debug not only files but URL =) So, last step will be good FireFox extention, which add "Debug" button to toolbar and on press - will signal to NetBeans for start debug session =)

Posted by romary on July 15, 2009 at 01:40 PM CEST #

Thank you by adminim

Posted by mirc on August 22, 2009 at 09:20 PM CEST #

Sweet! Took a while to find this but this works beautifully (so far). I'm a complete newbie (< 1 day) to netbeans (previously Eclipse which I could never get the debug to work) and I'm really pleased. Thanks

Ubuntu 10.05.01 (lucid)

Posted by john.lamont john.lamont on July 26, 2010 at 04:39 PM CEST #

how about the xdebug without using xmapp, i just trying apache 2.2, mysql 5.2 and php 5.3

is it possible? what modifications in the cofig file i must do?

thanks in advanced

Posted by gerardo on August 22, 2010 at 10:10 PM CEST #


Posted by guest on February 22, 2011 at 03:57 PM CET #


Posted by guest on March 24, 2011 at 04:56 AM CET #

Also note that you can set a debugger proxy in this dialog, if you need one.

Posted by JeffRubinoff on July 13, 2011 at 09:31 AM CEST #

I can't understand this yet.

In my php web project, I have an index.php file which is called for every url, using mod_rewrite,

so if the url is, the index.php file is called, and inside that it detects the url and calls a function named "view_single" in the class named "customers".

I put a breakpoint in that function in that class file, and expecting it to pause execution so I can examine variables, but it does not stop at the breakpoint.

I am specifying the url to debug in NB IDE as and the NB IDE says xdebug is running.

If I put a breakpoint in the index.php file, it does stop, but it does not help when debugging class methods.

As a last resort, I can insert the command xdebug_break(); in the line in my class method and it will stop, but this is not ideal.

Am I not understanding how a path mapping should be used in this scenario?

Posted by guest on April 01, 2014 at 09:59 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blogs is written by NetBeans developers who contribute to the PHP support mainly.


« December 2016