Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans + XDebug Breakpoints not working

I know there are countless of questions regarding this subject, however no matter what I've tried I've had no luck whatsoever. The problem I'm encountering is regarding breakpoints when using NetBeans and XDebug (on Windows 8.1 if that affects anything).

The issue is that no breakpoints are working. By default when debugging with NetBeans, it stops on the first line and this does successfully happen. Therefore NetBeans is somehow connecting to XDebug. However, any other breakpoints in any other files are not working.

I've tried various different settings in the php.ini file but no luck so far. I've also tried switching on the XDebug log file so that maybe I can analyse what's going on, but this also didn't work. Finally I've tried setting breakpoints using xdebug_break() which also didn't work.

XDebug settings in php.ini

;[XDebug]
; Only Zend OR (!) XDebug
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\xampp\tmp"

Project Run Configuration on NetBeans

Project Run Configuration

Advanced Configuration

I've already looked at the following:

  • http://articlebin.michaelmilette.com/making-xdebug-work-with-netbeans-on-windows/
  • Xdebug ignores breakpoints
  • http://wiki.netbeans.org/HowToConfigureXDebug#Tips_from_the_NetBeans_Forums

Also note that this was working 3 days ago, however today no breakpoints are working.

Additional Info

I've run the following command in cmd php -v and the following warning was shown:

Warning: Module 'xdebug' already loaded in Unknown on line 0

Does this mean that xdebug is trying to be loaded twice? If so I'm not sure how this can be solved

like image 848
Daniel Grima Avatar asked Jun 22 '15 13:06

Daniel Grima


People also ask

How to put breakpoints in NetBeans?

Start the ide and open the file that contains the source code that you want to debug. Set a breakpoint at each line where you want the debugger to pause. To set a breakpoint, place the cursor at the beginning of a line and press Ctrl-F8/⌘-F8 or choose Debug > Toggle Line Breakpoint.

How do I debug XDebug?

Press F5 to start the debugger. Click the new XDebug Helper extension and click the Debug option. Finally, refresh the page in the browser to let VSCode react and start the debugging process.


1 Answers

Figured out what the problem was. I know that this answer will be very specific, however it might help someone in the future.

So while inspecting the code I noticed that someone added code that cleared all cookies when the login page loaded. Once the cookies are removed XDebug didn't work. The reason is that for XDebug to work it sets a cookie with the session id for example 'netbeans-xdebug' which is sent with every request on the website.

It's a very simple issue but it took nearly 2 days to find out what was going on. Once again I know that this is a very specific case but maybe it might help someone out there.

Happy coding!

like image 183
Daniel Grima Avatar answered Sep 20 '22 02:09

Daniel Grima