Robert Basic's blog

Debugging two PHP projects in Netbeans at the same time

by Robert Basic on August 19, 2011.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

I’m currently working on some Symfony2 bundles and I have one Netbeans project for the main Symfony2 app and one project for the bundle. The bundle files are completely separated from the app and they are just linked (ln -s) together. It works great, except for the case when I need to debug some part of the bundle’s code with Netbeans + xdebug. The debugger starts for the “main” project, which is the Symfony2 app, but setting breakpoints with Netbeans (y’know, by clicking the line number) for the bundle doesn’t really work, as those are in the other project and not in the debugged one, rendering the whole debugging useless.

The solution is pretty easy actually: instead of setting breakpoints with Netbeans, use xdebug_break() where you want the break to happen and it will happily be caught by the IDE. After the break happened use the “Step into” (F7) functionality to see what’s going on.

Tags: debugging, netbeans, xdebug, xdebug_break.
Categories: Development, Programming, Software.