Chris
Chris

Reputation: 361

netbeans not stopping on breakpoint

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

Upvotes: 11

Views: 16836

Answers (8)

Sliq
Sliq

Reputation: 16494

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).

Upvotes: 5

tanmaya biswal
tanmaya biswal

Reputation: 75

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).

Upvotes: 2

Jan Pešek
Jan Pešek

Reputation: 111

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).

Upvotes: 9

Matthijs
Matthijs

Reputation: 1142

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

Upvotes: 4

bpile
bpile

Reputation: 380

Is port 9000 available for usage, try changing it to 9001 (both Netbeans and php.ini). I would first try to breakpoint with xdebug_break() and see what is shown in "Variables" window. At least superglobals must be shown.

Btw: breakpoints with IDE (left side: line numbers) cannot be created on a blank line or line with comments, it has to contain some code.

Upvotes: 0

Yasar
Yasar

Reputation: 99

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

Upvotes: 4

Ranjan
Ranjan

Reputation: 263

Make sure that your netbeans setting as follow:

Tool->option dialog box will open now click on PHP there are number of tabs click on Debugging and check the debugger port is 9000

Upvotes: 2

Robert de W
Robert de W

Reputation: 306

Best is to tunnel through SSH, setting your remote host to localhost. It will prevent you from getting messed ip with firewalls, nat or port forwarding.

Upvotes: 1

Related Questions