X

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

Join the discussion

Comments ( 10 )
  • Joris Thursday, April 2, 2009

    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)?


  • rmatous Friday, April 3, 2009

    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


  • romary Wednesday, July 15, 2009

    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 =)


  • mirc Saturday, August 22, 2009

    Thank you by adminim


  • john.lamont john.lamont Monday, July 26, 2010

    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)


  • gerardo Sunday, August 22, 2010

    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


  • guest Tuesday, February 22, 2011

    jhkhjk


  • guest Thursday, March 24, 2011

    545


  • JeffRubinoff Wednesday, July 13, 2011

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


  • guest Tuesday, April 1, 2014

    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 website.com/customers/view/123, 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

    http://website.com/customers/view/123?XDEBUG_IDEKEY=netbeans-xdebug 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?


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services