2

I have a netbeans project with a directory tree like this:

<source folder>
|
|---> gui <web root folder>
|      |
|      L---> datos.php
|
L---> index.php

datos.php changes the working directory to .. (source folder) and includes index.php like this:

chdir('..');
require 'index.php';

If I put a breakpoint inside datos.php, the debugger breaks on it correctly, but when putting one in index.php it ignores it.

The strange thing is 6 months ago I had the same problem and I was able to fix it. Now I don't know why it stopped working and what I did back then to fix it.

More info:

xdebug log shows the following command for breakpoint setting:

breakpoint_set -i 315 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php -n 51
breakpoint_set -i 316 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/gui/datos.php -n 39 

In both cases xdebug responds with state="enabled"

And if I debug manually, I can use the following command to set the breakpoint, which works:

breakpoint_set -i 315 -t line -s enabled -f file:///../index.php -n 51

But I don't know how could I make netbeans issue the breakpoint_set command with the same file:///../index.php argument and not file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php or any other way I can make this work.

Thanks in advance for any help!

  • Are you using symlinks? – Derick Feb 07 '13 at 17:01
  • @Derick, I'm not using symlinks. However today I tried again and breakpoints started working ?! I'm trying to find why it didn't worked 7 days ago, but now it does. xebug.log shows the same as before, only this time it stops at every breakpoint: <- breakpoint_set -i 4 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php -n 51 -> Can't recall making changes in xdebug or NB – Tomás Girardi Julio Feb 07 '13 at 20:21

5 Answers5

9

You always can try using xdebug_break();

For example :

<?php
    for ( $i=1, $j=0; $i<10; $i++) { 
        xdebug_break();
        echo "<br>Line $i";   // will stop here
    }
?> 

will add a breakpoint in the following line.

Hope that helps a little...

Victor
  • 3,841
  • 2
  • 37
  • 63
  • 1
    Thanks! Great tip! I'll try it next time I have difficulties like this one. I haven't experienced the same problem again, nor have I discovered the reason for that time it occurred. I'll hope it wont happen again, but at least I have a new tip to try if it happens. – Tomás Girardi Julio Apr 19 '13 at 21:41
  • Great!! Glad you like that! Good luck! :) – Victor Apr 26 '13 at 18:12
2

Breakpoints are working again. I don't have any clues to why they didn't worked before but now they do. I can't remember doing any changes in xdebug or Netbeans either.

xdebug.log shows me the same as before, but now it stops at the setted breakpoint:

<- breakpoint_set -i 4 -t line -s enabled -f file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php -n 51
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="4" state="enabled" id="14290001"></response>

<- run -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///Users/tomasgirardi/NetBeansProjects/datamed/index.php" lineno="51"></xdebug:message></response>

However, if anyone knows why this could had happend, sharing it could be helpful either way: probably me or someone else will be able to avoid having similar troubles in the future.

  • I saw the same behavior - not working, then just working. It's sad to say, but for anyone having this issue I would recommend quitting Netbeans and MAMP and restarting them. Especially after you've changed the project settings. Just curious - is your project configured to copy to another directory? – brentlightsey Sep 06 '13 at 12:05
2

This issue is more specific to people who are using remote servers for their web apps.

I had the same problem. Xdebug ignores breakpoints really helped me however i have given solution more specific to netbeans, but the essence is the same, which ever IDE you are using. Just map your local project path with your remote server path.

My environment is WINDOWS 7 and website is hosted on UBUNTU VM. I am using NETBEANS from Windows 7 and has setup a remote project.

My xdebug logs

<- breakpoint_set -i 4 -t line -s enabled -f file:///C:/Users/ali/Documents/NetBeansProjects/test.com.au/cgen/src/Acme/TestBundle/Controller/CreateController.php -n 39

->

The real problem was the project path in netbeans [C:/Users/ali/Documents/NetBeansProjects/test.com.au] and the project path on the webserver. /home/ali/sites/test.com.au

Fix: In Netbeans click on your project > properties > Run Configuration > Advanced > Just put the appropriate server path and equivalent project path. It will work fine.

Community
  • 1
  • 1
Ahad Ali
  • 398
  • 5
  • 11
0

Same problem was solved by commenting xdebug.extended_info = 0. Also one may switch it to 1.

0

To get it to work again i changedxdebug.remote_host=127.0.0.1 to xdebug.remote_host=localhost in php.ini

below is my config for xdebuga

xdebug.remote_enable=1
        xdebug.remote_port=9001
        xdebug.remote_handler=dbgp
        xdebug.remote_host=localhost
        xdebug.remote_autostart = 1
         xdebug.show_local_vars = 1
        xdebug.profiler_enable = 1
        output_buffering=off 
        xdebug.idekey=netbeans-xdebug
katwekibs
  • 1,342
  • 14
  • 17