The problem:
I can not get xdebug to work with PhpStorm or NetBeans in localhost. I have the proper Xdebug ext installed based on the wizard. I can see Xdebug is installed properly from phpinfo() and php -v output. I got a new hard drive at work with a new OS install and ever since then I can't get Xdebug setup to work.
I can not get the breakpoints to hit when accessing the application through the web/Postman. It's like the breakpoints aren't there or no connection is detected. There is no log file generated.
What does work:
In PhpStorm I hit the debug phpunit.xml icon then it runs my PHPUnit tests and Xdebug does work, breakpoints are hit, and log files are generated.
I have tried:
Many versions of Xdebug including 2.55, 2.60, 2.61 both 64 and 32 bit and both thread safe and non thread safe
Hosting with php -S and with XAMPP Apache
NetBeans and PhpStorm
My php.ini xdebug section
[Xdebug]
zend_extension=C:\xampp7.1\php\ext\php_xdebug-2.6.1-7.1-vc14.dll
xdebug.remote_enable=1
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log=C:\xampp7.1\php\ext\xdebug.log
xdebug.idekey="PHPSTORM"
I don't know what else to try. I thought maybe it could be a company firewall issue or something but none of my coworkers have this issue nor did I before the new HD. I'm on Windows 10 Enterprise could it be some Windows configuration?
Credit to LazyOne for figuring out the solution!
Adding xdebug.remote_autostart=1 to the php.ini worked! Thanks so much
Related
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.
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"
I just installed OSX Mavericks, and upgraded to Netbeans 8 PHP/HTML5.
In my previous install Netbeans 7.2 everything worked great and i had local debugging, through xdebug and MAMP.
After installing the new netbeans i no longer have access to xdebug. I try to debug the cli script it runs through...never connects to xdebug and i see the waiting bar.
The script will run all the way through and it will just continue with the (waiting-to-connect) until i manually end the xdebug session.
After ending it. I can no longer run The Run Project or Debug Project buttons. They just do nothing.
I am using MAMP and have edited all php.ini i can find with this:
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debu$
xdebug.remote_enable=on
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
php --ini returns the .ini in /etc
php_ini_loaded_file() through netbeans returns false.
Anyone know what else i can do to track down which ini file is being loaded.
Or know the problem here.
Like i said everything was working until i upgraded to netbeans 8.
After installing the new MAMP it renamed the php.ini to php.ini.default.
Netbeans could not find it. i renamed php.ini.default to php.ini and now everything works
We were with this problem in a new DELL machine. McAfee was blocking. Uninstalled McAfee and functioned normally.
I'm running Eclipse on Ubuntu 13.1 (I know, the worst Linux ever).
The fact is that I'm not used to Eclipse moved from Komodo 2 weeks ago, and the main reason why I'd migrated to Eclipse is debugging. But I can't put that to work. I already follow some tutorials with no joy.
My Xdebug is installed and working (checked with phpinfo()). I'm configuring Eclipse to work with Xdebug, but when I start the debugging it ignores the break points, even if I check to "Break at First Line" it won't break.
Here's a summary of the scenario that I have:
System: Ubuntu 13.1 64bits
PHP: 5.5.3-1ubuntu2.1
Xdebug: 2.2.3
Eclipse Platform: 3.6.2
PDT: 2.2.1
Tnx!
Problem solved! Actually the xdebug was installed but I missed one configuration. The xdebug.ini file was with only the following line:
zend_extension=/usr/lib/php5/20121212/xdebug.so
I'd added the following lines:
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
and it's working! Just reconfigured the eclipse debug and is working.
After upgrading to php 5.4.16 and installing netbeans IDE 7.3.1 on my mac osx 10.8.4 Netbeans reports a 'waiting for connection (Netbeans - xdubug)' when initiating the debugging. I tried a few things as suggested on Waiting For Connection (netbeans-xdebug) MAMP OS X and xDebug seems OK installed, but not connecting with NetBeans, but nothing helped sofar. Having said that, I'm not very experienced with these kind of installations and the mac osx ;-(
Some more info:
I use Apache/2.2.22 and mysql.
I upgraded to php 5.4.16 using http://php-osx.liip.ch/. After that upgrade the php.ini file does not include xdebug info, but the 50-extension-xdebug.ini file does contain the following info:
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_autostart=off
xdebug.remote_port=9000
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
Then I added:
xdebug.idekey=netbeans-xdebug
xdebug.remote_log=/tmp/xdebug.log
..to this 50-extension-xdebug.ini file (as somewhere suggested in xDebug seems OK installed, but not connecting with NetBeans).
I made another attempt by adding the contents of 50-extension-xdebug.ini to php.ini and restart the server, but no result.
The info box for xdebug shown by phpinfo() indicates xdebug is enabled and IDE Key is netbeans-xdebug. Then again, using the 'php -i | grep xdebug' terminal command doesnt show any result, so I'm not sure whether xdebug is actually enabled or not (?)
Any suggestions with respect to fixing the connection problem?
Thank you in advance.