NetBeans 11.3 waiting for connection to Xdebug - php

I am using Windows 10, NetBeans 11.3, PHP7.4.9, Apache/2.4.46 (Win64), XAMPP v3.2.4 and MySQL.
My php.ini file has the following settings:
output_buffering=off
[XDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.7-7.4-vc15-x86_64.dll"
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
xdebug.remote_enable = 1
xdebug.idekey="netbeans-xdebug"
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost:81"
xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
xdebug.remote_cookie_expire_time = 36000
NetBeans configuration:
Debugger port: 9000
Session ID: netbeans-xdebug
Stop at first line: Checked
All other options are unchecked
When I click on debugging icon (Ctrl + F5) it gets stuck on "waiting for connection (netbeans-xdebug)" while shows the page completely without stopping at the break points.

xdebug.remote_host = "localhost:81" is certainly not correct. The remote_host should have the value of the IP address or hostname where your IDE runs. This is likely just localhost.
You should also upgrade to Xdebug 3.1, which has much better logging functionality for troubleshooting connection errors through it's xdebug_info() function, and xdebug.log and xdebug.log_level settings.
Please do refer to the upgrade guide though, as some setting names have changed. You would likely only need:
zend_extension = "c:\xampp\php\ext\php_xdebug-3.1.3-7.4-vc15-x86_64.dll"
xdebug.mode=develop,debug # replacement for xdebug.remote_enable
xdebug.start_with_request=1 # replacement for xdebug.remote_autostart
xdebug.idekey="netbeans-xdebug"
xdebug.client_port = 9000 # replacement for xdebug.remote_port
# I would recommend to use the default 9003,
# but you need to update Netbeans config to
# say the same too.

Related

XDebug only works on localhost and not remote host

I've installed xdebug on my raspberry pi with visual studio code and everything is working except that I can't use xdebug with a remote host.
In php.ini and xdebug.ini and php.ini I have xdebug.remote_connect_back = 1 however whenever I load the page from my personal computer I just get listening for xdebug in vs code.
this is my configuration in php.ini
[Xdebug]
zend_extension=/usr/lib/php/20180731/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
and this is my configuration in xdebug.ini
zend_extension=/usr/lib/php/20180731/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_handler = dbgp
xdebug.remote_connect_back = 1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000
It should work when I open the webpage on my computer but nothing happens. And there isn't even a log file in /tmp/.

I need to restart NetBeans after each PHP debug session and don't know why?

NetBeans IDE 8.2 (Build 201705191307)
PHP 5.5.38 (due to legacy application)
Chrome 66.0.3359.170 (Official Build) (64-bit)
In the last few days my NetBeans debug stops working after one debug run and will only debug after I restart NetBeans. I've tried disabling all Chrome extensions other than NetBeans Connector and tested if restarting browser and stack would help but only restarting NetBeans works. It will also freeze up in the middle of a debug.
I have not touched php.ini
This is killing my productivity. Has anyone had this problem and how did you fix it?
UPDATE
I set up Visual Studio Code and debugging works fine so this must be a NetBeans issue.
Unchanged php.ini (same settings that worked last week)
[xdebug]
zend_extension = C:\xampp_php_5.5.38\php\ext\php_xdebug-2.4.1-5.5-vc11.dll
xdebug.idekey = netbeans-xdebug
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:/xampp_php_5.5.38/xdebug"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_connect_back = 0
xdebug.remote_host = 192.168.1.114
xdebug.remote_port = 9000
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = req
xdebug.trace_output_dir = "C:/xampp_php_5.5.38/tmp"
xdebug.remote_log = "c:/xampp/tmp/xdebug/xdebug_remot.log"
xdebug.show_local_vars = 9
xdebug.trace_output_dir = "C:/xampp_php_5.5.38/tmp"
Derp, I 'fixed' it by removing xdebug.remote_autostart=1 from my xebug.ini file, see nginx php-fpm xdebug netbeans can start only one debug session .

Can't figure out to let Xdebug work in combination with PhpStorm and XAMPP

I followed this steps, recommended by Xdebug based on phpinfo():
Download php_xdebug-2.4.0rc4-5.6-vc11.dll
Move the downloaded file to C:\xampp\php\ext
Update C:\xampp\php\php.ini and change the line
zend_extension = C:\xampp\php\ext\php_xdebug-2.4.0rc4-5.6-vc11.dll
Restart the web server
I also unchecked the 'ignore external connections through unregistered server configurations in PhpStorm. In PhpStorm port 9000 is configured. This port isn't used by an other application.
In the php.ini file I listed the following configuration:
[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.4.0rc4-5.6-vc11.dll
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.trace_output_dir = "C:\xampp\tmp"
The DLL file exists.
I also enabled the debug functionality in chrome via the xdebug addon.
Which step do I miss?
You're probably going to want to set xdebug.remote_enable = 1 or the remote debugging will be disabled.
Also, set the remote debug port phpStorm is set to use:
xdebug.remote_port=9000 (I'm assuming port 9000, it's the default, but check phpstorm)
To debug every request (if you don't have the chrome plugin for a browser for example) use xdebug.remote_autostart = on

It is possible avoid only external connections to my xdebug with Ngnix and PHPStorm?

I have a development environment in my computer, I use nginx and PHPStorm with Xdebug for my debugging, I need to debug in my environment but other people also connects to my machine for testing purpose, it is possible that when I active my debug this only affect me and not for they?
Update:
My xdebug.ini looks like this:
zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.idekey = PHPSTORM
xdebug.remote_log = /tmp/xdebug.log
xdebug.remote_enable = 1
xdebug.remote_connect_back = 0
xdebug.remote_handler = dbgp
xdebug.remote_port = 9001
xdebug.remote_autostart = On
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp
xdebug.remote_host = localhost
The key here is the setting: xdebug.remote_host. The default value is localhost, which guarantees that Xdebug only contact a debug client which is listening on your localhost and configured port
More detail: Xdebug Settings Document
& Remote Debugging Document

PhpStorm XDebug with a remote browser

I have debugging enabled from my localhost - RHEL. So my phpstorm installed on localhost works fine when i request a url from the same box as the apache server.
However, I would like the debugging to work from another machine (different host). Is there a setting that i am missing to enable. that.
my ini file :
zend_extension = ${extension_dir}/xdebug.so
xdebug.profiler_append = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_aggregate = 0
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = /tmp
xdebug.profiler_output_name = cachegrind.out.%p
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_host =localhost
xdebug.remote_port = 9000
xdebug.remote_mode = "req"
xdebug.allowed_clients = ""
xdebug.remote_connect_back=1
xdebug.idekey="mykey"

Categories