We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13643
    • 44 Posts
    I’m hoping there’s someone else out there who has run into this issue in NetBeans, but it may apply to other IDE’s as well. I have created a custom manager page per the tutorial and I’m having some trouble with it. For testing purposes, I trimmed index.php down to just 2 lines of code:
    $output = "Houston, we have a problem.";
    return $output;
    

    I set a breakpoint on the first line, and fire up my debugger (xDebug, which works great on front-end pages). Usually, a green arrow would pop up on the breakpoint, but on this page, I get no green arrow, and no indication of what line will execute next. The only way I can tell where I am is to look at the call stack, which gives the current function as "core/components/mycmp/index.php.{main}:29]".

    Does anyone understand this syntax? My index.php has only 2 lines - why is it referring to line 29? (Incidentally, it has started on that number every time, even before I reduced the file to 2 lines). What does {main} refer to? And why is my breakpoint not working? I can hit F5 until the page loads completely in the browser, and the result is as expected ("Houston, we have a problem" is displayed on the screen) but execution never halts on breakpoint.

    Can anybody help me out here? embarrassed

    (BTW, on forum posts, I know the syntax for code and PHP syntax highlighting, but I can’t seem to combine the two. Does anyone know how to do that?)
      • 26903
      • 1,336 Posts
      Try using the ’debug file’ option rather than the ’debug main project’ one, also select ’do not open web browser’ in the advanced web configuration’ options.
        Use MODx, or the cat gets it!
        • 13643
        • 44 Posts
        Quote from: shamblett at Jun 29, 2011, 04:02 AM

        Try using the ’debug file’ option rather than the ’debug main project’ one, also select ’do not open web browser’ in the advanced web configuration’ options.
        Thanks, but I’m already doing both those things.
        • I really recommend trying PhpStorm. It’s not free, but you can try it for 30 days and, well, it just works when it comes to debugging and many other things...
            • 13643
            • 44 Posts
            Thanks for the suggestion - I’ll give it a try.
              • 13643
              • 44 Posts
              OK, after a few hours of testing the strength of a brick wall with my head huh I finally found the solution (with some help from robinK via PM). I probably should have mentioned in the initial post that I’m using remote debugging, my IDE being on a different machine from my local webserver. In NetBeans, this may (and in my case, does) require that you specify Path Mapping for the project, so it knows where to find the files for debugging. To do this, go to Project Properties -> Run Configuration -> Advanced, enter the server path for your project (e.g. /var/www/mywebsite.com) and click the little gray button to navigate to the project folder (e.g., \\mywebserver\mywebsite.com). Save your configuration, and everything should work together nicely.

              As a side note, my program execution is still pausing at places where I haven’t set breakpoints. This isn’t a major problem, since I can just hit F5 until I get to the real breakpoint(s), but I wouldn’t mind fixing it if anyone has a clue what might be happening.
                • 13643
                • 44 Posts
                Quote from: javadecaf at Jun 29, 2011, 07:06 PM

                As a side note, my program execution is still pausing at places where I haven’t set breakpoints. This isn’t a major problem, since I can just hit F5 until I get to the real breakpoint(s), but I wouldn’t mind fixing it if anyone has a clue what might be happening.
                Well, I just resolved this one, too, so in the interests of complete documentation, here’s the fix. In NetBeans, go to Tools -> Options, choose the PHP tab, and under "Debugging," uncheck "Stop at first line".

                "And they all lived happily ever after!" (or until the next bug, anyway) grin