Xdebug suddenly not properly working on Eclipse Neon PHP Ubuntu 16 - php

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"

Related

Xdebug not breaking on breakpoints after new HD

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

Debug menu disabled in Netbeans 8.0.2 when using Wampserver 3.1.1 and preinstalled Xdebug

I'm trying to debug a PHP project for class, and when I try to set a breakpoint in Netbeans, nothing happens. If I go to the Debug menu, everything's grayed out except Attach Debugger, Stack (though everything in that submenu is grayed), New Breakpoint, and New Watch. However, if I try to set a breakpoint through the Debug menu...nothing.
I have looked at (and tried) just about every solution on StackOverflow related to Netbeans, Xdebug, and WAMP. This includes changing the php.ini file, changing the configuration settings in the project in Netbeans, changing the Debugging options in the PHP area of the Netbeans options menu. I have even tried installing a second Xdebug, but still nothing. There was one question in the past with this issue, and the OP updated his Netbeans to a more recent version and that fixed the problem, but I have the latest version already.
I've also looked at the NetBeans site and forums, Wampserver site and forums, and general Google searches for this issue. I finally gave up and I'm turning to the StackOverflow collective intelligence.
My installations:
Windows 10 64-bit
Netbeans 8.0.2
Wampserver 3.1.1
PHP 5.6.18 (though I tried switching to PHP 7.0 and the problem persisted)
My server configuration shows that Xdebug is installed, and phpinfo() also shows it.
My code in php.ini:
[xdebug]
zend_extension ="C:/wamp/bin/php/php5.6.18/zend_ext/php_xdebug-2.4.0rc2-5.6-vc11-x86_64.dll"
xdebug.remote_enable = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="C:/wamp/tmp"
xdebug.show_local_vars=0
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

Xdebug installed but does not display in Phpinfo for Xampp

I have the latest Xampp and Php 5.3 on Mac Mountain Lion oSX 10.8.2. I just installed Xdebug and configured it in the php.ini. I downloaded from this link and followed the instructions. Also put the following entries in php.ini
[Xdebug]
zend_extension=”/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so”
xdebug.remote_port = 9000
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/Applications/XAMPP/xamppfiles/temp"
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_enable = On
xdebug.trace_output_dir = "/Applications/XAMPP/xamppfiles/temp"
Php -m displays the Xdebug modules but the phpinfo() does not show Xdebug. Read the solutions to questions Why is xdebug not showing up in phpinfo() and No xdebug in phpinfo() and it does not work for me. Note: I have restarted my Apache from Xampp Control multiple times.
Suggestions on
Any ways to rectify this?
Would Xdebug still work for me on my Eclipse Studio?
How can I provide permission to httpd to access Xdebug on Moutain Lion?
Thanks.
Make sure that the zend_extension path actually exists your your machine.
Your particular path seems like it is not valid.
zend_extension=”/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so”
I made the mistake of copying and pasting the path from some tutorial, but mine was actually located on this path:
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
Also, make sure that you are editing /Applications//XAMPP/xamppfiles/etc/php.ini, which is the php.ini associated with XAMPP. Which can easily be confused with /etc/php.ini which may be present on your machine.
Here is what I added to my php.ini for reference:
[xdebug]
zend_extension="/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-2012121/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
So this was more of a port issue on Mountain Lion. By default 9000 is assigned by Mac for firewall stuff and it kept assigning various ports for one or the other thing. I utilized Network Utility Port Scan on Mac to check for available ports. Also running the php script described below may give some debugging info as provided here
The detailed Configuring Eclipse part from this Stack Overflow Question helped the most.

Netbeans xdebug nightmare

I know what you're thinking, ANOTHER netbeans xdebug post?
Well, I've tried everything I've seen in other posts, and nothing seems to work. Here's my setup:
OS: Ubuntu 9.10
PHP: 5.2.1
Netbeans: 6.8
The following is in my /etc/php5/apache2/php.ini
zend_extension=/usr/lib/php5/20060613/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
I've tried switching ports (I've tried 9001, 9002, and 9034 so far), using zend_extension_ts, adding additional xdebug parameters in the config file, but nothing seems to work: Netbeans still says it's waiting for connection (netbeans-xdebug)
If I look at my phpinfo, I do see a whole section on xdebug, and the parameters are correct.
Any help would be greatly appreciated!
I have no idea what happened, but I switched my debug port to 9000 and upgraded to Netbeans 6.9, and it works now.
adding those lines solved my problems (usually)
xdebug.remote_enable = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug seems not working in "run as script" mode
try it on your local website

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
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"
Checklist for xdebug:
Check that xdebug is loaded in phpinfo(), and the runtime value matches expected configuration.
xdebug.remote_enable is on.
xdebug.extended_info should be on for breakpoints to work.
xdebug.remote_port must be same as ide and unused.
xdebug.remote_handler is dbgp.
xdebug.idekey should be set to same as ide's key if xdebug.remote_autostart is on.
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.
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:
Firewall must allow Netbeans to listen for connection with configured host.
Tools -> Options -> PHP -> Debugging, check port. Also check session id if xdebug.remote_autostart is on.
Project type must be PHP.
Project Properties -> Source, web root must be correct.
Project Properties -> Run Configuration, index file need to be a php (or empty) for Ctrl+F5 to work.
Project Properties -> Run Configuration -> Advanced, debug url should be "Default" or "Ask Everytime".
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:
PHP output_buffering does not need to be off. (But may help in debugging)
OPCache (Zend Cache) module can be loaded.
xdebug.profiler_enable can be enabled.
Please edit this answer if you found something new.
Check that you have the right version of Xdebug for your version of PHP (including Thread-safe/non-thread-safe and 64bit/32bit).
In some newer versions of PHP, you need to use zend_extension, not zend_extension_ts, regardless of whether you have the TS version of Xdebug.
(I am replying with an Answer since the formatting in comments wasn't working properly)
Same happened for me: worked once and then stopped. However, I reached a point in my config where it started working without problems and I can share.
First I moved on top of php.ini the ioncube loader:
[PHP]
zend_extension=/Applications/MAMP/bin/php5/zend/lib/ioncube_loader_dar_5.2.so
Then I put these lines in the xdebug config:
[xdebug]
zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
And commented out all the lines about Zend Optimizer
[Zend]
;zend_optimizer.optimization_level=15
;zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3
;zend_optimizer.version=3.3.3
I work on MAMP, this is why the paths to my libraries are referred to my MAMP folder.
Good luck
zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.3-5.4-vc9.dll"xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp"xdebug.remote_host = "localhost" xdebug.remote_port="9000" xdebug.remote_mode=req xdebug.trace_output_dir = "C:\xampp\tmp" xdebug.idekey="netbeans-xdebug"
this is working for me..
Here's how I was able to get it to work w/ mulitple PHP-FPM homebrew installations.
I used this excellent article for the multiple installations:
https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew
In the comments of that post you'll see recommended how to install xdebug, bottom line:
brew install php56-xdebug
You have to install xdebug for each verions of PHP you have installed. Homebrew will make a xdebug.ini file for each version of php you installed. Each will have a path like:
/usr/local/etc/php/<version # i.e. "5.6">/conf.d/ext-xdebug.ini
This article installs DNSMasq which runs on xdebug's default port (9000), so you'll need to change the xdebug port to something else (9001 works fine.)
Edit the above mentioned ext-xdebug.ini file (or files if you installed more than one version of php.) Here's what works for me:
[xdebug]
zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"
; General config
; Dumps local variables on exception
xdebug.show_local_vars=On
; Dump server variables
xdebug.dump.SERVER=*
; Dump global variables
xdebug.dump_globals=On
xdebug.collect_params=4;
; Tracing
;xdebug.auto_trace=On
;xdebug.trace_output_dir= /opt/local/php_traces/
xdebug.show_mem_delta=On
xdebug.collect_return=On
; Debugging. You might need to specify your host with some additional options
xdebug.remote_enable=1
: from http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler="dbgp"
The first two lines are all that is in the original homebrew file.
BTW - when I installed multiple PHP versions, this ext-xdebug.ini file was only created for the first PHP version I installed. I simply copied this file to the other PHP version locations, and changed the "php56-xdebug" part of the path in line 2 to reflect the proper php version.
Notice "xdebug.remote_port=9001"
Then in Netbeans (I'm using 8.02 Mac osX10.10.3) I use the following settings.
Go to Preferences->PHP->Debugging
Debugger Port: 9001
Stop at First Line: (unchecked)
Watches & Balloon Evaluation: (checked - there's a warning but it works fine for me.)
Also worth noticing is that in order for xdebug to show up using phpinfo() (or command line php -i) I need to restart apache with:
launchctl unload -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
sudo apachectl restart
launchctl load -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
For some reason my setup requires me to run this every time I startup. Kind of a pain, but I incorporated it in a shell command to easily switch between versions.
One more hint: part of brew info php56 says:
OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using
the brew version you need to make sure /usr/local/sbin is before /usr/sbin
in your PATH:
PATH="/usr/local/sbin:$PATH"
Until I added this to my .profile_bash file, changes I made to each version's php-fpm.conf file were not recognized. Everything else seemed to work so it was confusing.
Hope this saves someone else time & trouble.
If you are still stuck you could try the following:
Download a new version of xdebug via the wizard (http://www.xdebug.org/wizard.php) and if you follow the instructions maybe you will be lucky.
Switching off the firewall might help.
Use a different port in netbeans, for instance in my case using 9001 in netbeans and 9000 in xdebug worked.
Add to php.ini file: xdebug.idekey=netbeans-xdebug.
Find out if you have a xdebug.ini file and add the xdebug related php.ini lines to that file.
Always make sure that you restart your apache service to test everything.
In my case - host is on another server, Net-beans 11 - I need to open terminal to remotehost
Window -> IDE Tools -> Terminal -> Remote Terminal
P.S. If u type export XDEBUG_CONFIG="idekey=netbeans-xdebug" in that terminal, and start debugging session, u can debug console scripts

Categories