Kanna Kim
Kanna Kim

Reputation: 381

PHP xdebug on NetBeans doesn't work

I did 3 days of research and couldn't really solve my issue.

Here is my xdebug setting in php.ini

xdebug.idekey="netbeans-xdebug"
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1    # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true

My NetBeans run-configuration

One thing I notice writing this question was even when I'm debugging the port is always set to 8000 when I set it to 9000:

enter image description here

enter image description here

So I thought maybe NetBeans is pointing to a wrong php.ini ? I run phpinfo() in my test.php and it gave me this:

enter image description here

Now I'm totally lost. What should I do to make xdebug to work on NetBeans?

EDIT: I'm using internal web-server on NetBeans

EDIT: Things started to progress but now NetBeans give me this weird output:

"D:\bit_nami\php\php.exe" "-S" "localhost:9001"
[Tue Aug 08 02:42:38 2017] PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\bit_nami\php\ext\php_pdo_firebird.dll' - 占쏙옙占쏙옙占쏙옙 占쏙옙占� 찾占쏙옙 占쏙옙 占쏙옙占쏙옙占싹댐옙.
 in Unknown on line 0
[Tue Aug 08 02:42:38 2017] PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\bit_nami\php\ext\php_pdo_oci.dll' - 占쏙옙占쏙옙占쏙옙 占쏙옙占� 찾占쏙옙 占쏙옙 占쏙옙占쏙옙占싹댐옙.
 in Unknown on line 0
[Tue Aug 08 02:42:38 2017] PHP Warning:  Xdebug MUST be loaded as a Zend extension in Unknown on line 0
[Tue Aug 08 02:42:38 2017] PHP Warning:  Module 'xdebug' already loaded in Unknown on line 0
[Tue Aug 08 02:42:38 2017] Failed to listen on localhost:9001 (reason: 액세스 권한에 의해 숨겨진 소켓에 액세스를 시도했습니다.
)
<br />
<b>Warning</b>:  PHP Startup: Unable to load dynamic library 'D:\bit_nami\php\ext\php_pdo_firebird.dll' - 占쏙옙占쏙옙占쏙옙 占쏙옙占� 찾占쏙옙 占쏙옙 占쏙옙占쏙옙占싹댐옙.
 in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Warning</b>:  PHP Startup: Unable to load dynamic library 'D:\bit_nami\php\ext\php_pdo_oci.dll' - 占쏙옙占쏙옙占쏙옙 占쏙옙占� 찾占쏙옙 占쏙옙 占쏙옙占쏙옙占싹댐옙.
 in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Warning</b>:  Xdebug MUST be loaded as a Zend extension in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Warning</b>:  Module 'xdebug' already loaded in <b>Unknown</b> on line <b>0</b><br />
Done.

Upvotes: 2

Views: 1171

Answers (2)

Navid
Navid

Reputation: 910

You need to match port three different places:

  1. php.ini file
  2. Netbeans > Options > php > Debugging > Debugger Port
  3. Netbeans > Project Properties > Run Configuration > Advance Web Configuration > Debugger Proxy Port (Assuming you are running Local Web Site (running on local web server)).

Then make sure to set xdebug.remote_host or xdebug.remote_connect_back=1 . Setting both of them does not work.

Following setting is recommended for php.ini

[xdebug]
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.idekey="netbeans-xdebug"
xdebug.remote_handler=dbgp
xdebug.remote_autostart=off
xdebug.remote_port=9001
xdebug.remote_host=localhost
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_name=xdebug-profile-cachegrind.out-%H-%R
xdebug.var_display_max_children = 128
xdebug.var_display_max_data = 2048
xdebug.var_display_max_depth = 128
xdebug.max_nesting_level=200

For more information visit How To Configure XDebug

Upvotes: 2

powerpete
powerpete

Reputation: 3062

I'm running Netbeans with php and XDebug (on Windows/Apache). It's working fine. (I checked it also with the Netbeans Built-In Web Server)

The relevant part of my php.ini:

zend_extension=C:\Bitnami\wampstack-5.4.35-0\php\ext\php_xdebug-2.2.6-5.4-vc9.dll
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

In the default Setup (with the Built-in Server) the browser talks over Port 8000 to the PHP Built-In Server and the PHP Build-In Server talks over Port 9000 to the Netbeans debugger Part.

So on some Windows Systems you have to open/allow these two ports in the firewall settings for the php executable.

Upvotes: 0

Related Questions