Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans + Xdebug + php not working

My netbeans does not work the breakpoints using xdebug, my configuration looks correct, so I configured the first time I ran up to stop debugging the first time since then has never worked, someone had this problem? The version of my netbeans is 6.8 and the version of php is 2.5.2.

my php.ini:

zend_extension_ts = d:\wamp\bin\php\php5.2.5\ext\php_xdebug-2.0.2-5.2.5.dll
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
xdebug.profiler_enable=1
like image 873
Yargon Avatar asked Jun 03 '10 02:06

Yargon


People also ask

Where is xdebug PHP INI?

For Windows, this is normally "c:\xampp\apache\bin\php. ini". Important note for Windows 7 & Vista users: As of August 2013 (XAMPP version 1.8. 2), the file "php_xdebug.


2 Answers

In my case this line needed to be included in the php.ini:

xdebug.remote_autostart=on

Here is the configuration section for XDebug:

[xdebug]
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.remote_autostart=on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "d:/wamp/tmp"
like image 178
Ray Avatar answered Nov 15 '22 21:11

Ray


Checklist for xdebug:

  1. Check that xdebug is loaded in phpinfo(), and the runtime value matches expected configuration.
  2. xdebug.remote_enable is on.
  3. xdebug.extended_info should be on for breakpoints to work.
  4. xdebug.remote_port must be same as ide and unused.
  5. xdebug.remote_handler is dbgp.
  6. xdebug.idekey should be set to same as ide's key if xdebug.remote_autostart is on.
  7. Sometimes it help to set xdebug.remote_host to intranet IP or computer name instead of local ip 127.0.0.1. PHP must be allowed by Firewall to connect to this host and port.
  8. Setting xdebug.remote_log to a file will help in checking what is wrong. Disable the log once debug is working.

Sample config:

[xdebug]
xdebug.extended_info=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=on
xdebug.idekey="netbeans-xdebug"

Checklist for NetBeans:

  1. Firewall must allow Netbeans to listen for connection with configured host.
  2. Tools -> Options -> PHP -> Debugging, check port. Also check session id if xdebug.remote_autostart is on.
  3. Project type must be PHP.
  4. Project Properties -> Source, web root must be correct.
  5. Project Properties -> Run Configuration, index file need to be a php (or empty) for Ctrl+F5 to work.
  6. Project Properties -> Run Configuration -> Advanced, debug url should be "Default" or "Ask Everytime".
  7. Project Properties -> Run Configuration -> Advanced, path mapping must be correct. (e.g. empty if there are no mappings)

(Most default options work out of the box, so if you are desperate try to delete and recreate the project.)

False Instructions, tested on PHP 5.5 and xdebug 2.2:

  1. PHP output_buffering does not need to be off. (But may help in debugging)
  2. OPCache (Zend Cache) module can be loaded.
  3. xdebug.profiler_enable can be enabled.

Please edit this answer if you found something new.

like image 24
Sheepy Avatar answered Nov 15 '22 20:11

Sheepy