netbeans not stopping on breakpoint

16,146

Solution 1

One more tip that's not mentioned here: make sure that you have your web root directory set correctly.

Go to File -> Project properties -> Sources -> Web root -> Browse and select your actual web root directory.

My configuration is Kubuntu 15.04, PhP 5.5 and I'm developing CakePhP application and I had to set my webroot directory to /app/webroot [or /app/View/Theme/webroot in case you're using themes]. Without this setting, xdebug was ignoring breakpoints, although otherwise working (and actually stopping on the first line of the index.php file).

Solution 2

I asked the same thing and got this quite good answer: How to track execution time of each line / block of lines / methods in PHP?.

Some additional notes on that (stuff i've collected in other SO posts in my own research with this problem):

  1. The port might be also 9001 (seems to work for some people while 9000 don't).
  2. Switching to PHPStorm IDE is a real alternative that solves this problem (as PHPStorm has included perfectly running xdebug already).
  3. Download a new version of xdebug via the wizard (https://xdebug.org/wizard.php) and if you follow the instructions maybe you will be lucky.
  4. Switching off the firewall might help.
  5. Add to php.ini xdebug.idekey=netbeans-xdebug.
  6. Find out if you have a xdebug.ini file and add the xdebug related php.ini lines to that file.
  7. you have to un-comment the zend_extension line (i.e. remove the ';' at its begninning), so Xdebug is actually loaded.
  8. make sure Xdebug is loaded, calling phpinfo() from a PHP file (just to be sure).

Solution 3

There are several things you can try:

  1. Check if the port is available (or try a diffrent port)
  2. Make sure the port is selected in netbeans
  3. Use the IP instead of the pc-name
  4. Use a browser extension like https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc
  5. Use "xdebug_break()" in your code to see if it breaks there
  6. Check your phpinfo() to see if xdebug is loaded

Solution 4

I had a similar issue and came across a post to fix the problem. My html form (testform.html) was calling a php script (runQuery.php) and Netbeans could not break at the set break points in my runQuery.php

After checking all the configuration settings in php.ini and Netbeans by searching on forums like this one, I discovered that netbeans will only break on the break points if the Index file for the project is a PHP file. This is very important otherwise you will spend hours trying to figure out why break points are not working.

In Netbeans go into the File/Project Properties/Run Configuration and check that the Index file is a PHP file. In my case I changed my index file from testform.html to testform.php and it worked, I was able to break on break points.

Yasar

Solution 5

Please check this. In your php.ini make sure all this options are enabled. Otherwise add it in the end of your php.ini file (for example /etc/php/5.6/apache2/php.ini ).

[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.default_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"

Check the path(/usr/lib/php5/20121212/) for xdebug.so in your file system accordingly change zend_extension value.

1st line zend_extension value is here for ubuntu users. I think that variable no need to change. Please uncheck the stop at First line(tools->options->php->Debugging).

Share:
16,146
Chris
Author by

Chris

Updated on June 04, 2022

Comments

  • Chris
    Chris almost 2 years

    I have xdebug running but it doesn't matter where I put my break point it never stops.

    php.ini

    [xdebug]
    zend_extension_ts = c:\wamp\bin\php\php5.2.8\ext\php_xdebug-2.1.2-5.2-vc6.dll
    xdebug.remote_enable=on
    xdebug.remote_handler=dbgp
    xdebug.remote_host=Chris-Pc
    xdebug.remote_port=9000