Netbeans not connecting to xdebug on MAMP, showing "waiting for connection" - php

I am trying to set up xdebug so that I can debug my php wordpress project. I am using MAMP to run the project and have configured xdebug in the php.ini file as follows.
zend_extension="/Applications/MAMP/bin/php/php5.5.26/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
debug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.idekey=“netbeans-xdebug”
xdebug.remote_port=9001
xdebug.remote_autostart=1
This is working as I can see xdebug in my phpinfo().
phpinfo
I'm now trying to connect netbeans to xdebug so that I can actually debug my code. I have pointed netbeasns to xdebug-netbeans at port 9001. I then try to debug my project but it just gets stuck on
waiting for connection(netbeans-xdebug)
It has worked for me twice (it went to debugging mode) but after clicking continue (it stopped on the first line in index.php) it wouldn't work anymore and the page wouldn't load. I then tried to reload the debugging but it went back to waiting for connection.
Any idea what's wrong?
Thanks.

In the php.ini file
implicit_flush = On
(by default it will be Off).
Here PHP will tell the output layer to flush itself automatically after every output block.
I Hope this helps.

Related

PHP Xdebug with NetBeans and Apache

I’m trying to do my first steps with PHP. I decided to use NetBeans, which seams helpful.
NetBeans is running on my local Windows machine. My testpage is running on an Apache2 webserver in my Ubuntu HyperV M.
Up to now everything works fine. Now I enabled remote debugging over Xdebug. Therefore I added the following lines to the php.ini:
[debug]
; Remote settings
xdebug.remote_autostart=off
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.2.20
xdebug.remote_port=9000
The connection is ok and debugging works. Unfortunately the debugger stops at each line and not only at my breakpoints. That makes my tests inefficient. Therefore my question is how to tell NetBeans to stop at breakpoints only?
Found the solution by myself. There is an option "stop at first line" in the Netbeans PHP debugging settings. Removing that did the trick.

Getting ERR_EMPTY_RESPONSE when listening xdebug connections in PhpStorm

I used to debug PHP code locally in PhpStorm using Xdebug but recently it just stopped working. When enabling listening Xdebug connections my PHP application immediately responds with empty response and I see ERR_EMPTY_RESPONSE in Chrome and Firefox. Debugger works though and execution stops on breakpoints as usual. When listening is disabled, application works as expected.
Project is running on local Apache Web Server, but I also explicitly specified path mappings.
How can I "debug" debugger to figure-out what prevents web-server from giving out http response?
xdebug.ini:
zend_extension=xdebug.so
[xdebug]
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_port=8888
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/var/opt/profiler"
xdebug.profiler_enable_trigger=0
xdebug.trace_enable=0
xdebug.trace_enable_trigger=0
xdebug.trace_output_dir="/var/opt/trace"
xdebug.max_nesting_level="1000"
xdebug.remote_host=localhost
xdebug.remote_mode=req
xdebug.idekey=PHPSTORM
PhpStorm debugger config:
I've run into this as well with PHP 7.1.27, xdebug 2.7.0. In webserver log on each debug request there was a message "zend_mm_heap corrupted".
The problem has been solved by upgrading to PHP 7.1.28 and xdebug 2.7.1
Based on this I think the only xDebug upgrade is crucial.

Apache 2 + Xdebug + PHP 7.2 on Ubuntu 18.04 not working

I am not able to step through my code. It works fine in 16.04. I dual boot into 18.04 and configured Apache 2, Xdebug, PHP 7.2 the same way but I cannot seem to stop at any of my break points.
The debugger stops ONE TIME at the first line (as that is how I have it configured in NetBeans 8.2). After that the debugger never breaks again. I disabled opcache to see if that was interfering but it didn't seem to help.
Note that if I debug a PHP-CLI application then Xdebug works fine. It seems to be an Apache 2 related configuration issue and I cannot seem to determine why.
Here is my 20-xdebug.ini file:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
#xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.max_nesting_level=300
Argh!!!!
Found the issue. For some reason my browser had cookies disabled therefore XDEBUG could not store its cookie thus all subsequent calls back to the web application from the browser were not processed via XDEBUG.

Xdebug suddenly not properly working on Eclipse Neon PHP Ubuntu 16

It was working properly yesterday, all I did today was installing docker, which shouldn't have anything to do with it.
The situation is that I can start debugging, but when I hit any of the "Step" (F5, F6, F7, F8) buttons it will say "PHP Applications (Waiting...)" as if it was executing code, but it will never end.
If I disable "Break at First Line" it will even go to the breakpoint, and I can evaluate any variable previous to the breakpoint, but it won't continue.
I've tried creating new projects, reinstalling xdebug and php, switching the port, uninstalling docker just in case, changing xdebug parameters in php.ini.
The thing is that the debugger works, but only until the first breakpoint.
php.ini:
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.profiler_output_dir="/tmp/xdebug/"
xdebug.profiler_enable=off
xdebug.profiler_enable_trigger = off
xdebug.remote_enable=on
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.idekey=ECLIPSE_DBGP
xdebug.remote_connect_back=1
xdebug.show_local_vars=0
xdebug.max_nesting_level=400
Some of the variables I added for testing, with no success.
phpinfo()
Finally I had some time to play with configurations, after reinstalling xdebug for php7, trying different rules in /etc/php/7.0/cli/conf.d/20-xdebug.ini, I read in a github project issues thread:
I solved by remove all Watch Variables.
And I thought, "it cannot be that", but gave it a chance, and it did it. Maybe playing with the .ini file helped, but what made it work at last was removing all the expressions in eclipse debug window.
Here is the git issue thread (the project is a PHP Debug Adapter for Visual Studio that has nothing to do with my environment): https://github.com/felixfbecker/vscode-php-debug/issues/205
Anyway here is the 20-xdebug.ini configuration that is working for me:
zend_extension="/usr/lib/php/20160303/xdebug.so"
xdebug.remote_autostart=on
xdebug.remote_enable = On
xdebug.remote_port = 9000
xdebug.remote_host = 127.0.0.1
xdebug.show_error_trace = 1
xdebug.remote_handler="dbgp"

Eclipse xdebug session never completes and holds on 48%

When i tried to debug file it's hold's on 48% and comuniacate wrote says: Waiting for Xdebug session...
I am trying to get xdebug working with Eclipse Neon.1a / php (on xampp windows 7). I have verified that xdebug is enabled in phpinfo(); I have remote_debug=On.
I have installed xdebug with https://xdebug.org/wizard.php hints.
My php.ini file:
[xdebug]
zend_extension=/path/to/xdebug.so(.dll)
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9001
xdebug.remote_host=localhost
xdebug.remote_log=/path/to/xdebug_remote_log
xdebug.remote_connect_back=1
I tried to use remote_port=9000 but problem doesn't perish.
In php.ini i have also commend:
zend_extension = D:\Serwer\xampp\php\ext\php_xdebug-2.4.1-7.0-vc14.dll
i tried to coment one line of zend_extension or another.
I have good settings in eclipse xdebug settings.
This is my first post on forum please be tolerant :)
you need to check the xdebug_remote_log, I got the same issue.
I: Connecting to configured address/port: 127.0.0.1:19006.
E: Time-out connecting to client. :-(
this is the error printed by xdebug.

Categories