Xdebug remote debuggin - crashing on step over, step into etc - php

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"

Related

Xdebug is started in the debug console but not working?

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.

Xdebug not stepping over or into - using VSCode and Windows

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

Xdebug with PhpStorm won't stop at random breakpoints

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?

Eclipse does not run Xdebug or Zend debugger on Mac OSX 10.8.2?

I was able to successfully install both Zend as well as Xdebugger. Verified by Phpinfo as well as Eclipse verifies the Zend debug successfully installed. Although whenever I run debug from eclipse for
Xdebug it hangs at 57%`
and for Zend debugger
the browser keeps processing/busy but nothing happens
Unsure what is causing this
-> Firewall issues?
-> No Selinux in Mac so not sure if it is a permissions issue
Any clues would be helpful.
Thank you.
it seems like a miss configuration of debug. I will try to help you showing my working configurations.
This is my php.ini piece for xdebug.
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9060
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=On
It is important to note about the parameter debug.remote_host. If your client side is not allowed here, you will stuck on 57%. The value here is the IP of the machine where you are running eclipse. If you are running apache/php and eclipse in the same machine the localhost IP should work.
Adapt zend_extension parameter to your world.
Other reason you can stop in 57% is the web site is not running. Apache/PHP only will send xdebug metadata if the site is running. If you got an internal error, for example, you will be stuck on 57% also. Eclipse stops on 57% waiting for a xdebug session. You must be sure apache/php started a debug session.
Make sure the Debug configuration on eclipse is using the correct PHP server. If you are trying to run eclipse in an invalid PHP server or a PHP server which is not well configured you will stop on 57% also. So review the PHP server parameters on Debug Configurations.
Other important review you have to made is about the Xdebug configuration for eclipse. The port Debug port field must be filled with the same value of parameter xdebug.remote_port. If they are different you will be stuck in 57% also.
Please, let me know if it was helpful.
For Xdebug, this is likely a misconfigured path mapping in Eclipse. There are 10s of questions related to that here on stackoverflow and 100s of hits on google. Please check there first.

Breakpoints not working in Eclipse with XDebug

I have been trying to set up debugging using XDebug in Eclipse for the last few hours without success.
I have the following in my etc/php5/apache2/php.ini file
[XDebug]
xdebug.remote_enable=on
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=off
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
The zend_extensions = /usr/lib...... was given to me by the custom installation instructions on the XDebug site. I followed the setup instructions exactly as they are on that page - http://xdebug.org/wizard.php
But from what I have read typing the command php -m should show XDebug twice, once under PHP modules and once under Zend modules. Well it is showing up under neither for me. So it seems that XDebug is not getting loaded at all?
Anyone any ideas on how to fix this problem and get XDebug working?
You've editted /etc/php5/apache2/php.ini file which is for apache. You'd want to edit /etc/php5/cli/php.ini for the command line interface's options.
If you pass in the phpinfo() from a web site, that PHP has run through Apache of course. And then the wizard will give you settings for the Apache set-up. If you would have passed the phpinfo() output (php -i) from the command line, it would have given you the settings for the CLI.
Something similar happened to me, the first time I setup xdebug in Eclipse it worked just fine, but the next time I tried it, it wasn't stopping at breakpoints. After a lot of research it turned out that I had 2 Eclipse instances running (one for Java and another for Php) and that caused some kind of issues with the debugger.
After closing both instances and starting Eclipse with php workspace first and then Eclipse with java workspace, xdebug worked fine again. My only idea is that debug port was already used when I tried to use it; or something like that.
An other common problem is that you use a router to get through INTERNET and that you had to forward XDEBUG PORT (generaly 9000) on your PC to make XDEBUG working with ECLIPSE.
But your router gives a dynamic IP to your PC and one day your mobile phone connects to the router before your PC and gets the IP address you configuredon you router IP FORWARDING !
The solution getting a static IP from your router. Here is an explanation: http://webologix.com/fr/blog/xdebug-eclipse-fonctionnement-aleatoire.html

Categories