3

I am running PHP 5.3.2, Apache 2.2.14 and xdebug 2.2.0rc1 on my Ubuntu 10.04 laptop, and I am trying to set up debugging on localhost in Netbeans 6.8.

My problem is that breakpoints I set in Netbeans are being ignored. Otherwise it it seems to work correctly. For example, I get pretty var_dumps, xdebug traces, xdebug remote logs and I can also tick the box so that it breaks on the first line of the PHP script.

Based on other websites and SO questions (e.g. SO1, SO2, SO3) I've checked all of the following:

  • That the php.ini file I am editing is being used
  • That xdebug is loaded as zend_extension=/full/path/to/xdebug.so (not extension=xdebug.so)
  • Thread safety is disabled in PHP and I am using the non-thread safe version of xdebug
  • That the path to the breakpoints is correct in the xdebug remote log (see code snippet below this list, the paths in that snippet and others not shown are correct)

    <- breakpoint_set -i 1014 -t line -s enabled -f file:///var/www/mockup/test.php -n 8 -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1014" state="enabled" id="135610002"></response>
    
  • Manual calls to xdebug_break() work

I have also tried to set up the server path and project path in the Netbeans project properties because it feels like that could be the problem, but it hasn't helped. Currently I have server path as /var/www/mockup and project path as /common/rsync/Dropbox/active-archives/code/Locus/mockup

However, /var/www/mockup is a symlink to the longer path anyway so I don't even know if this is necessary? It does not work whether I specify the path mapping or not...

Community
  • 1
  • 1
cfogelberg
  • 1,468
  • 19
  • 26

3 Answers3

2

Building on @Derick's input, the solution that works is:

  • Change NetBean project properties to copy files from source folder to /var/www/Locus
  • Remove all path maps from the Run configuration
  • Point my browser at localhost/Locus/

In other words, it's not just symlinks in the path to the source file that cause problems, but symlinks in the server path as well.

cfogelberg
  • 1,468
  • 19
  • 26
1

Xdebug (through PHP) doesn't support symbolic links yet (there is an issue at http://bugs.xdebug.org/view.php?id=627). PHP/Xdebug always uses the fully expanded link so you will need to make sure netbeans sets up a breakpoint like:

breakpoint_set -i 1014 -t line -s enabled -f file:///common/rsync/Dropbox/active-archives/code/Locus/mockup/test.php

You will have to set-up a path mapping. After you've verified that the breakpoint_set include the correct path, it should work.

Derick
  • 35,169
  • 5
  • 76
  • 99
  • Thanks @derick. I ran a quick test last night and confirmed that it works if I set up the project directly in /var/www. However I still can't get it to work elsewhere - maybe I've got my server path maps set incorrectly? --- E.g. in the xdebug remote log I'm getting entries with file:///common/rsync/Dropbox/active-archives/code/Locus/mockup/test.php, I've set the server path to /var/www/mockup and the project path to /common/rsync/Dropbox/active-archives/code/Locus/mockup but it still skips the breakpoint? Thanks again! – cfogelberg Apr 04 '12 at 12:37
0

Here is how I fixed it:

In my local xampp environment on my mac I had set up a vhost that mapped to a directory outside of the apache root directory (/source/my_project). My project in Net Beans was set up to use /source/my_project as the location of the project as well. So I had "no" URL mapping problems since the path I was using in the Apache vhost was no different than what I was using in the Net Beans. Or perhaps Apache thought of this directory different than Net Beans in anycase I could not get path mapping to work. But when I moved /source/my_project to /apache/htdocs/my_project and I used that path for my Net Beans' project source and mapped my vhost to that directory then the debugger worked. P.S. I had version control set up on /source/my_project so I changed my_project to a symbolic link and it still worked in subversion.

N D
  • 717
  • 6
  • 10