I recently installed Xdebug on my server and I have a very strange problem :
Sometimes, Xdebug don't stop a breakpoint, sometimes it does. It is very confusing because I spent time investigating why PHP didn't go to a certain point of my code, before understanding that it was only Xdebug that "choose" randomly which breakpoint it want to stop, and which it doesn't want. I tried to close PhpStorm and restart it, and sometimes some of the breakpoints work again and other doesn't anymore. It seems that its completely random.
I'm using PhpStorm 2019.1, and Xdebug 2.7. I did the PhpStorm Xdebug validator that told me everything is OK with the Xdebug config.
I'm using Xdebug with "zero-configuration", calling scripts from Chrome with the extension. Do you think it can be a bug of PhpStorm?
Related
Xdebug is not working despite phpinfo() is showing Xdebug section and in VS Code the red point is displayed and the control panel. Also the debug console is started as well.
I've tried to reinstall it again. I removed Apache and install XAMPP and then install Xdebug there.
There is currently an issue with Xdebug 3.2 on Windows (specifically Apache) where it enables all features even when not requested. It is possible that this also affects other functionality like breakpoints. Until this is fixed, I recommend to use Xdebug 3.1.6, which you can still find on the historical downloads page.
However, if you use xdebug_info() instead of phpinfo(), Xdebug will tell you what it tried to do (if anything at all) to connect to the debug client. There might be hints in there too.
Hopefully the following will give you enough to go on.
My setup
I'm using:
Windows 10 (now at build 19043.1288),
VSCode (v1.61.2) with
PHP debug (v1.21.1),
both Firefox and Google Chrome browsers,
XAMPP (v3.3.0)
Xdebug (now v3.1.1-7.4x86_64)
I'm also running Ubiquiti network controller, and BitDefender AV in the background.
PHP.ini
[Xdebug]
zend_extension = xdebug
;zend_extension = "c:\xampp\php\ext\php_xdebug-3.1.1-7.4-vc15-x86_64.dll"
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.log = "c:\xampp\htdocs\j4\tmp\xdebug.log"
Problem
I've had VSCode/XAMPP/Xdebug working with Joomla 3 for well over a year without issues. I went away for a couple of weeks and when I came back I wasn't able to single step into any of the Joomla 3 modules/classes. VSCode would stop at breakpoint, but both single step and step into immediately went to the parent calling function.
Ah, I said to myself, probably Windows did something - may be a good time to upgrade to J4, as well as update my environment. Same problem. Stops at 1st breakpoint, won't single step or step into - it won't stop at subsequent breakpoints. Appears to single step in the core J4 modules. Stack appears normal - initialised variables can be inspected.
What I've tried
Everything! To keep this relevant - I've now installed a completely fresh, out of the box, unadulterated, XAMPP, Joomla4 and Xdebug (as recommended by Xdebug wizard). I've also temporarily disabled my AV (BitDefender). I don't have any firewalls on my PC, as I'm behind a network firewall.
Just in case, I did a deep virus scan and disk check - nothing.
Prior to installing everything fresh, I was able to get an Xdebug log file, but now I can't. I also noted that the breakpoints wouldn't reset - I'd remove all the BPs and they'd come back on next run. I'd have to stop and restart the PHP debug in VSCode to make them go away.
I suspect that the latest Windows updates (or maybe the last few), did something to my dev environment.
However, it's also possible that I've missed something stupid in the setup, as I've been round the circuit several times already, and my head isn't functioning as it should.
Where I need help
I'm now at a loss at what to try next - any suggestions? If no-one else can reproduce this - it means something in my system has glitched, any help would be appreciated.
Update 1
I discovered that a v2 of Xdebug had crept into my php/ext directory - not too sure how - and that was why I wasn't able to get a log file to work. I now have the correct version (3.1.1) of Xdebug installed and working. The single step issue, however, remains.
I now have a log from VSC debug console as well as from xdebug.log: see here
One thing I observe is that there are many errors associated with deprecated functions - I would have expected them to be warnings and not errors!
There are also numerous cases of "error evaluating code".
I have highlighted the place where the code stopped in the logs with "************". I don't know if this is expected or normal, but it does seem to occur a short time before the breakpoint stop - line 431 vs line 651 in the debug console log.
Update 2
Just in case anyone has any interest - I installed the latest version of Eclipse IDE with PDT. Used exactly the same XAMPP/htdocs directory as before - and Xdebug works as expected. No issues with single stepping.
This means, I believe, that Windows, XAMPP, Xdebug and Joomla can be ruled out as culprits, as these are common to both environments. Conversely, it also means that there's something going on with VSCode, or at least with my particular VSCode setup.
Breakthrough (I think!)
It appears that a couple of variables (e.g. $this->missingclasses) I had put into the watch window were causing the problem. I suspect that over the course of a few VSCode updates the persistent internal objects associated with those variables had glitched/corrupted. When I deleted the offending variable watches - single step started to work again.
After seeing that that worked, I was able to put the watches back and single stepping worked as expected. Putting the same watched variables into Eclipse had no effect on single stepping.
Just for good measure, I also deleted and reinstalled PHP Debug - although I'm pretty sure the watched variables, that couldn't be evaluated, were the real issue here.
I will leave this a couple of days, and then I'll close this with a suggested solution
I have a virtual development environment in vagrant which I have provisioned using puphpet.com. Until today, everything was in perfect working order, but suddently - seemingly unrelated to my actions - Xdebug stopped working.
I use phpstorm for development and debugging and what happens is, I set a breakpoint in phpstorm, then I enable the remote debugging listener in phpstorm and the Chrome Xdebug Helper extension. When the code reaches the breakpoint, execution is paused and I am able to investigate the different variables, but as soon as I try to step through my code with either continue, step over or step into, phpstorm simply exits debug mode and my browser shows a 503 error.
I had a look at the syslog, which shows that it is a segmentation error, so not much in the way of clues there. Then I enabled the Xdebug log. I don't really know how to interpret it, but it seems to me that it logs that it was succesfully able to stop at a breakpoint and then when the error happens it just stops logging - which makes sense considering that it seems to be a segmentation error.
I tried updating xdebug with pecl upgrade xdebug and I tried running it on a port different from the port 9000 default. Did not change anything.
Any suggestions what I might try now?
My virtual machine is running Ubuntu 14.04 LTS x64. PHP is v5.6.14 and Xdebug is v2.3.2.
Here is a link to my puphpet configuration in case it might help: https://gist.github.com/webconsult/dfa23f65ce2394624b0d
I faced the same issue after researching the error I found the solution and it worked!
kindly add the lines at the end of php.ini same as given just change your path...
[xdebug]
zend_extension="/usr/lib/php/20180731/xdebug.so"
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port="9003"
I´m starting working with PHP on Eclipse and I´m having a bad time with XDebugger. This is my first time setting up this enrironment...
I´m running Eclipse 3.8.1 with PHP Development Tools SDK (I have also C++ installed on this Eclipse).
I´ve followed the instruction from the official xdebug site to install XDebug. It seens to be installed fine, as we can see from a phpinfo() call:
Well, once installed, I go to Eclipse, insert my breakpoints on the code, configure the debug configuration and when I call Debug As->PHP Web Application all I get is an empty window on Firefox with the following link:
http://localhost/myproject/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14380396300041
Absolutely nothing happens neither to Eclipse or on Firefox.
Here is my configuation for debugging:
PS: I haven´t installed anything related to ZEND. Is it necessary ? Here is a error I get when using the Zend Debugger option:
Help appreciated!!! Hope this will be basic learning for solving...
To debug on zend debugger, you need zend debugger installed.
For xdebug remote debugging (browser run) you have to enable dbgp protocol:
https://wiki.eclipse.org/Debugging_using_XDebug#Configuration
I'm running eclipse PDT on a xubuntu 10.9 VM, using xdebug to remote debug PHP 5.3.
I have been having a number of issues over the last 6 months, things like:
Debugger stops responding to breakpoints after being dormant for 20+ minutes.
Debugger will exit suddenly with the fatal error "unexpected termination". Requires eclipse to be restarted to debug again.
Non fatal errors will pop up, I possibly think this is due to modifying code during execution.
Is this an issue that can be fixed by upgrading or switching to Zen? Its really frustrating compared to using PyDev or Java debuggers.
Is anyone else experiencing this same sort of issue?
With Eclipse, xdebug is sometimes a little unstable. Here, I use Zend Studio with Zend Debugger and xdebug. Everything works fine.
About breakpoints stops, I got a issue too. The only way to control this was use the Zend Toolbar to call debugger from Firefox/IE.
I know people that works fine with Netbeans + xdebug, too.
Try to download and install Zend Debugger and configure your Eclipse to work with it. Eclipse Helios has many improvements around it - try it if you use a older Eclipse version.