Why isn't Xdebug working with Chrome, but it is with the internal PhpStorm browser? - phpstorm

My setup has local files running on WAMP. I have configured Xdebug to work fine when I try to set a breakpoint using the PhpStorm internal browser. However, I can't seem to make it work when using Edge or Chrome.
I have the Xdebug extension installed and turned on in the browser. The little "bug" is Green and if I hover over it, it says, "Debugging is enabled, has access to this site."
Within PhpStorm I have the "listening" icon on and green. Whereas, with the PhpStorm browser I can step through a program just fine and the results show up in the PhpStorm console, if I run the program in Edge the script runs, but nothing pauses and nothing is sent to the PhpStorm console.
I assume this is a configuration error, but I haven't got a clue. Let me know if there are any settings/files you need to see to help. Thanks in advance.
edit**
This is the phpinfo section on Xdebug:
xdebug
Version 3.1.1
Support Xdebug on Patreon, GitHub, or as a business
Enabled Features
(through 'xdebug.mode' setting)
Feature Enabled/Disabled Docs
Development Helpers ✔ enabled 🖹
Coverage ✘ disabled 🖹
GC Stats ✘ disabled 🖹
Profiler ✘ disabled 🖹
Step Debugger ✘ disabled 🖹
Tracing ✘ disabled 🖹
Optional Features
Compressed File Support yes (gzip)
Clock Source GetSystemTimePreciseAsFileTime
Directive Local Value Master Value
xdebug.auto_trace (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.cli_color 0 0
xdebug.client_discovery_header no value no value
xdebug.client_host localhost localhost
xdebug.client_port 9003 9003
xdebug.cloud_id no value no value
xdebug.collect_assignments Off Off
xdebug.collect_includes (setting removed in Xdebug 3) (setting removed in Xdebug 3)
xdebug.collect_params (setting removed in Xdebug 3) (setting removed in Xdebug 3)
xdebug.collect_return Off Off
xdebug.collect_vars (setting removed in Xdebug 3) (setting removed in Xdebug 3)
xdebug.connect_timeout_ms 200 200
xdebug.coverage_enable (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.default_enable (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.discover_client_host Off Off
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.file_link_format no value no value
xdebug.filename_format no value no value
xdebug.force_display_errors Off Off
xdebug.force_error_reporting 0 0
xdebug.gc_stats_enable (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.gc_stats_output_dir (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.gc_stats_output_name gcstats.%p gcstats.%p
xdebug.halt_level 0 0
xdebug.idekey no value no value
xdebug.log c:/wamp64/logs/xdebug.log c:/wamp64/logs/xdebug.log
xdebug.log_level 7 7
xdebug.max_nesting_level 256 256
xdebug.max_stack_frames -1 -1
xdebug.mode develop develop
xdebug.output_dir c:/wamp64/tmp c:/wamp64/tmp
xdebug.overload_var_dump (setting removed in Xdebug 3) (setting removed in Xdebug 3)
xdebug.profiler_append Off Off
xdebug.profiler_enable (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger_value (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.profiler_output_dir (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
xdebug.remote_autostart (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_connect_back (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_enable (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_host (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_log (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_log_level (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_mode (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_port (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.remote_timeout (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.scream Off Off
xdebug.show_error_trace Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.show_mem_delta (setting removed in Xdebug 3) (setting removed in Xdebug 3)
xdebug.start_upon_error default default
xdebug.start_with_request default default
xdebug.trace_enable_trigger (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.trace_enable_trigger_value (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.trace_output_dir (setting renamed in Xdebug 3) (setting renamed in Xdebug 3)
xdebug.trace_output_name trace.%c trace.%c
xdebug.trigger_value no value no value
xdebug.use_compression 1 1
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3

Related

When Xdebug is enabled in a web request it won't step over and breaks at every single line and enters every function in PhpStorm

I'm using Xdebug 3.
I'm able to step over normally in index.php at the beginning of the request until the request starts going through Laravel's complex routing and middleware system. After that, it breaks at every line and enters every function .
What hasn't worked
Setting nginx root directory to the actual folder instead of symlink
Disabling the resolve and force break options in the PhpStorm debug settings
Clearing PHPStorm cache and re-indexing
Removing any vendor libraries from "Excluded folders"
Removing the profile option from xdebug.mode in xdebug.ini
Disabling xdebug.start_upon_error
Disabling Clockwork
Debugger validation
Here's my xdebug.ini:
zend_extension=xdebug.so
; https://xdebug.org/docs/install
; xdebug.mode = profile
; Uncomment if you want to profile with clockwork xdebug.mode=debug,profile
xdebug.mode=debug
xdebug.start_with_request = trigger
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9003
; I think it might have problems writing to project folders in WSL so use /var/log
xdebug.log="/var/log/xdebug.log"
xdebug.idekey = PHPSTORM
xdebug.discover_client_host=true
Here are the PhpStorm Debug Settings:
The problem ended up being that I had overridden a Laravel library file with a custom version using the "files" section in composer.json. Apparently, Xdebug/PHPStorm got confused by the path mappings after that file was called.
I did the override long ago and it was never a problem for Xdebug before. I haven't updated PHPStorm, Xdebug or changed anything recently so I'm still not sure why it suddenly started occurring.

Debug session was finished without being paused It may be caused by path mappings misconfiguration

I'm trying to use xdebug with phpStorm, valet on macOs
I followed the instructions,
installed xdebug, added configurations and set the settings in phpStorm
xdebug config parameters:
xdebug.remote_enable=1
xdebug.remote_port=9003
xdebug.idekey=PHPSTORM
xdebug.remote_log=/tmp/xdebug.log
I keep getting this error message and xdebug doesn't breach at the break points:
Debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for 'dashboard.test' server at PHP|Servers or enable Break at first line
in PHP scripts option (from Run menu).
Do not show again
this is my configuration details
I tried many suggested solutions but none of them is working,
Update:
changed the host from https://dashboard.test into dashboard.test, the message disappeared but still can not step over or step into every line (break point)

Unable to watch variables value at PhpStorm breakpoint

I am facing a strange problem when I am debugging PhpStorm, I am using XAMPP + PhpStorm + Xdebug.
I write code below and set up 4 breakpoint
<?php
$a=1;
$b=2;
$c=$a+$b;
echo $c;
After I click listener button and debug button,Chrome visit http://localhost/index.php, the first break point is reached.
Then strange phenomenon is here:
I can not watch variables value of $a, $b and $c, no matter in debug window or I put mouse over these variables.
I click F8, the left 3 breakpoints will not reach. I have no idea where is the program's step now, but I know response is not return to Chrome because Chrome is still loading.
Even stranger, if I remove all breakpoints and not click listener button and not click debug button, Chrome load success, but once I click listener button and debug button, refresh Chrome, Chrome will load forever unless I stop listen and stop debug then Chrome will load success. That is wired; I have already uncheck 'break at first line', there is no breakpoints at all. I guess PhpStorm stuck somewhere, but I do not know where it is.
Can someone help me please,the other computer can debug success but this computer never debug success.
1) Show whole Xdebug log (share the file)
Xdebug log is here:https://www.dropbox.com/s/psfktprtl2jfftq/debug2.log?dl=0
And here is a yeserday ealier bigger log:https://www.dropbox.com/s/64jnwhscatjaihq/debug2-ealier.log?dl=0
2) PHP & Xdebug versions?
PHP and Xdebug version in picture below.
xdebug log
Xdebug 2.7 requires PhpStorm 2018.3.x or newer.
Either upgrade PhpStorm to latest stable 2018.3.x or downgrade Xdebug to 2.6.x. That will resolve the issue.

How do I get xdebug/step-debugging working with ddev?

I've been working with ddev on my Drupal projects, and now want to use xdebug so I have step-debugging with PhpStorm (or really any IDE would be fine). But I can't seem to get it to stop on breakpoints. I tried to follow the instructions in ddev docs but that doesn't do get me going, and I don't know what to do next. I did:
Set the 172.28.99.99 IP address as discussed there
Enabled xdebug using config.yaml xdebug_enabled: true and ddev start (and checked with phpinfo to see that xdebug was enabled.)
Put PHPStorm in "listen for debug connections" mode
Debugging xdebug in any setup can be a little trouble, but here are the steps to take:
First, reread the docs. You may want to read the troubleshooting docs rather than this issue, since they're maintained more often.
Make sure xdebug has been enabled; it's disabled by default for performance reasons. Most people use ddev xdebug on to enable it when they want it, and ddev xdebug off when they're done with it, but it can also be enabled in .ddev/config.yaml.
Don't assume that some obscure piece of code is being executed and put a breakpoint there. Start by putting a breakpoint at the first executable line in your index.php. Oh-so-many times people think it should be stopping, but their code is not being executed.
ddev ssh into the web container. Can you ping host.docker.internal (and get responses)? If you can't, you might have an over-aggressive firewall.
In PHPStorm, disable the "listen for connections" button so it won't listen. Or just exit PHPStorm.
ddev ssh: Can telnet host.docker.internal 9003 connect? If it does, you have something else running on port 9003, probably php-fpm. Use lsof -i :9003 -sTCP:LISTEN to find out what is there and stop it, or change the xdebug port and configure PHPStorm to use the new one . Don't continue until your telnet command does not connect.
Now click the listen button on PHPStorm to start it listening for connections.
ddev ssh and try the telnet host.docker.internal 9003 again. It should connect. If not, maybe PHPStorm is not listening, or not configured to listen on port 9003?
Check to make sure that Xdebug is enabled. You can use php -i | grep grep Xdebug inside the container, or use any other technique you want that gives the output of phpinfo(), including Drupal's admin/reports/status/php. You should see with Xdebug v2.9.6, Copyright (c) 2002-2020 and php -i | grep "xdebug.remote_enable" should give you xdebug.remote_enable: On.
Set a breakpoint in the first relevant line of the index.php of your project and then visit the site with a browser. It should stop there.
A note from #heddn: If you want to have xdebug running only for fpm, phpenmod -s fpm xdebug for example, instead of running enable_xdebug.
A note from #mfrieling: If you use a browser extension like XDebug Helper which sets an IDE key, that must be the same as on the server. Since DDEV 1.10.0 "there's a real user created for you inside the web and db containers, with your username and userid" which is also used as IDE key by default. The used IDE key must be the same on the server, the browser extension/cookie sent and PHPStorm. You can change the IDE key in DDEV by creating a file .ddev/php/xdebug.ini with the following two lines (replace PHPSTORM with the value you want use:
[XDebug]
xdebug.idekey = PHPSTORM
Your followups are welcome here!
Thanks, had the same problem and adding the file .ddev/docker-compose.xdebug.yaml fixed the issue.
However, I am running on a Mac / OSX and found these additional steps worked to discover the IP address of the internal host from inside the container:
1.) Log into the web continaner ddev ssh
2.) Run ping docker.for.mac.localhost
3.) Set the returned IP address for host.docker.internal in the above yaml file.
4.) Remove and start the DDEV.
Also worth mentioning validating xdebug in PHPStorm is useful to check the config.
Careful with Macs, as they may have php-fpm running. If it's the case PHP Storm won't find the connection (as it's already taken by php-fpm).
To see if it's the case run:
lsof -i :9000 -sTCP:LISTEN
if it returns something like php-fpm, then you have this issue
Try closing it (see PHP-FPM can't be closed ).
Running it once you have fixed it (potentially restarted your mac) you should see something like this:
➜ solrpoc lsof -i :9000 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
phpstorm 512 alejandro.moreno 490u IPv6 0xaf3eef0f3233a83 0t0 TCP *:cslistener (LISTEN)

XDebug not showing stack and trace in Sublime Text 2 on Window

I have the Sublime Text 2 XDebug plugin installed but the stack and trace panes are empty no matter what I do. The menu works after pressing shift+f8. The "add breakpoint" also works. However, whenever I select start debugging I get directed to my browser with the standard debugging info but nothing appears in the panes in Sublime Text.
I am on Win7 x64
WAMP Server 2.2 : PHP 5.4.3 + Apache 2.4.2
I checked via phpinfo() and xdebug_is_enabled() and xdebug is installed and running.
my current configuration (bin/apache/[apache...]/bin/php.ini, ofcourse:
zend_extension = "[wamp path]/bin/php/php5.4.3/ext/php_xdebug-2.2.0-5.4-vc9-
x86_64.dll"
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_autostart = On
;Trace settings
xdebug.auto_trace = On
xdebug.profiler_enable = On
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "[wamp path]/wamp/tmp"
Do note that the path to the extension is correct. The name of the extension itself is as above also. I checked this page a link but still nothing.
Any help with this would be appreciated. Thanks!
I had the same problem. My setup is Sublime Text 2 on a Mac.
In Sublime, goto View, Sidebar, Show Open Files.
Insert an XDebug breakpoint in your file. Start a debug session from your browser.
It should hit the breakpoint, which turns green.
Notice in the Sidebar files called, Xdebug Watch, Xdebug Stack, Xdebug Context and Xdebug Breakpoint.
Open one of these, say Xdebug Context, you should see a listing of variables.
Drag the tab for this file into one of the empty panels below
And voila!
I fixed my sublime xdebug that was not showing debugging info.
I am using MAMP and ST3.
Xdebug client in sublime text come with super_globals = true i just changed the setting in Xdebug user setting and it worked!
Go to Tools -> Xdebug -> Settings - User and add following lines
{
"super_globals": false,
}
The first thing to try to see which end is broken would be to create a "debug log". You can do that by making the setting:
xdebug.remote_log = /tmp/xdebug.log
And then restart your web server.
Once debugging starts, the file should contain debugging commands and responses and it will tell you whether connections were made, or failed.
If you update your question with the results, I'll update the answer if something on the Xdebug side is wrong.