How can I get Xdebug v3.1.1 to display output "beautified" with PHP 8.1?
Is it necessary to turn on some specific Xdebug configuration option in php.ini?
This is how I need the output on screen to look like:
And this is how it currently looks like:
This is my current Xdebug configuration in php.ini for PHP 8.1:
[XDebug]
xdebug.client_host=127.0.0.1
xdebug.client_port=9000
xdebug.mode=debug
xdebug.profiler_append = 0
xdebug.start_with_request=trigger
xdebug.remote_handler = dbgp
xdebug.start_with_request=yes
xdebug.log_level = 0
xdebug.force_display_errors=1
xdebug.force_error_reporting=1
xdebug.show_error_trace=1
xdebug.show_exception_trace=1
xdebug.cli_color = 1
xdebug.trace_format=1
xdebug.show_local_vars=1
You need to also list develop in the debug mode value:
xdebug.mode=debug,develop
https://xdebug.org/docs/all_settings#mode
https://xdebug.org/docs/develop#stack_trace
P.S. Rather unrelated... but better stick to the new Xdebug port (9003) and not old one 9000 -- it was changed for a reason (as it was often conflicting with php-fpm that also uses the same TCP 9000 port by default).
Sure, if it works then do not change .. but it's better to use safer option (may save a lot of troubleshooting time on a new machine/different setup in a future).
ALSO: xdebug.remote_handler = dbgp -- this is Xdebug v2, does nothing in Xdebug 3. And dbgp is the ONLY possible value anyway...
Related
Looking for some advice. Changed servers and I have setup Xdebug. PhpStorm detects it enabled, so does PHP, although I cannot get it to work.
(Firewall port opened, my firewall disabled, settings all configured, but I am getting nothing)
In order to identify the issue, I need to be able to see the Log of Xdebug, but I cannot get it to output anything. I tried it without a log file, then I have also created a log file and given Apache access to it, but still nothing.
I am running CentOS 8
Apache - Log_Debug enabled
Running on php7.3
PHP - track_erorr enabled.
/opt/plesk/php/7.3/etc/php.d/50-xdebug.ini
; Enable xdebug extension module
zend_extension=xdebug.so
xdebug.default_enable = 1
xdebug.idekey = "PHPStorm"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_host=123.123.123.123
(IP has been changed for obvious reasons)
Can anyone tell me why I cannot get Xdebug to write out any errors or connection attempts to: /tmp/xdebug.log
Here is my phpinfo() debug info:
Thanks for the comments, I didn't noticed Xdebug has updated its self.
After removing all previous reference i re-setup the the debug.ini
(I dont store custom ini settings in php.ini i reference them correctly)
Here is my updated xdebug.ini This works by using the browser Plug-in to enable to the Debugger mode
zend_extension=xdebug.so
xdebug.client_host = 123.123.123.132
xdebug.client_port = 9000
xdebug.connect_timeout_ms = 200
xdebug.force_display_errors = 1
xdebug.force_error_reporting = 1
xdebug.idekey = PHPStorm
xdebug.log = /tmp/xdebug.log
xdebug.log_level = 7
xdebug.mode = debug
xdebug.output_dir = /tmp
All default settings can be found here: https://github.com/xdebug/xdebug/blob/master/xdebug.ini
I’ve configured the virtual machine, installed apache2, php, MySQL and xdebug. The website works and I’ve configured VS but nothing happens when I debug the project in VS.
Note I have to use a VM because there is some trickery that is being done with open VPN.
I am no expert with PHP as I come from the ASP.NET world and I have never used Xdebug before.
I've been asked to add some additional information but the /etc/php/7.2/apache2/php.ini file is too large to add into this post. If you want some more information please ask for a section and I will post it.
In the mods-available folder is an xdebug.ini file that contains:
zend_extension=xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000 #if you want to change the port you can change
I've also set up an inbound rule in Azure for the server to a allow port 9000.
When running VS I have set up the Server URL and specified Xdebug Port 9000.
DBGp proxy is not set.
Thank you
Tim
I finally managed to get something to work.
I updated the xdebug.ini like this:
zend_extension=/usr/lib/php/20170718/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 86.180.220.70
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000 #if you want to change the port you can change
xdebug.idekey = "php-vs"
And, crucially, opened the firewall on my machine for port 9000.
Now I can't seem to set any break points in php that actually hit.
I'm assuming this has something to do with path mapping - plenty of stuff on google for Code but little if nothing for Visual Studio...
I have to say the documentation for doing things like this is SHOCKINGLY bad. Most examples are for a Windows php.ini file, not for Linux. If your a seasoned php programmer your probably used to it but for a newbie like me its an absolute minefield.
I am trying to set a zero-configuration debugging for PhpStorm/Docker/Xdebug.
Xdebug is installed properly (I can see it loaded on phpinfo()):
My PhpStorm setup for debugging is standard, listening on port 9000. Here is the xdebug config I'm using:
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = docker.for.mac.localhost
xdebug.remote_port = 9000
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_log = /var/log/xdebug.log
xdebug.idekey = "PHPSTORM"
Off topic: I am also wondering if using xdebug.idekey is the same as providing IDE key through Chrome extension?
When I click on PhpStorm to start listening for connections, and set in the configuration to break on first line, I am getting the following:
Looking at Xdebug logs, it is clear that container connected to client (which is also clear from the fact that I am getting an error when trying to debug).
At this point, I have no manual servers or remote debug configurations set up.
If I define a server and remote debug configuration, and set environment key:
environment:
- PHP_IDE_CONFIG="serverName=docker-server"
And then if I click to debug:
Debugging then works, and no errors appear.
But this is then not a zero-configuration debugging...
What am I doing wrong?
I am trying to use Xdebug for my Drupal project debugging. In some documentations, I saw that the Xdebug is able to find memory leaks as well. I tried to use that facility. But I am not getting any logs regarding that.
I configured my 20-xdebug.ini as follows
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir = "/home/myname/Desktop/xdebug/"
xdebug.trace_output_dir="/home/myname/Desktop/xdebug/"
xdebug.remote_log="/home/myname/Desktop/xdebug/xdebug.log"
xdebug.auto_trace=1
xdebug.collect_params=1
xdebug.trace_format=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=1
I am able to connect NetBeans with Xdebug and I can go through each break points. But there are no logs regarding this in the /tmp folder and there are no log files in the above given paths as well.
Am I doing something wrong? Please assist me on this.
maybe you need
xdebug.show_mem_delta = 1
xdebug.show_mem_delta
Type: integer, Default value: 0
When this setting is set to something != 0 Xdebug's human-readable
generated trace files will show the difference in memory usage between
function calls. If Xdebug is configured to generate computer-readable
trace files then they will always show this information.
I try to configure Xdebug Client for Sublime Text 3 on Windows 10 (with PHP Version 7.3.0 and 2.7.0RC2 Xdebug version).
I read issues for days because the panels context were always blank, but I solved it adding "super_globals": false in Xdebug.sublime-settings.
Now the Xdebug Context show:
The problem is the breakpoint never hits. never show me the Steps options (into, over). Even, don't show the little yellow arrow on left side.
I believe that it's related to path_mapping configure, but this really confuse me.
I dont understand why I need configure path_mapping if I work only on localhost on xampp.
php.ini:
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.7.0RC2-7.3-vc15.dll"
xdebug.remote_enable = 1
xdebug.remote_host = 127.0.0.1
xdebug.report_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_connect_back = 0
xdebug.idekey = sublime.xdebug
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.remote_log = "C:\xampp\php\tmp\xdebug.log"
You might need to add xdebug.remote_autostart = 1. Per the XDebug documentation:
xdebug.remote_autostart Type: boolean, Default value: 0
Normally you need to use a specific HTTP GET/POST variable to start remote
debugging (see Remote Debugging). When this setting is set to 1,
Xdebug will always attempt to start a remote debugging session and try
to connect to a client, even if the GET/POST/COOKIE variable was not
present.
See: XDEBUG EXTENSION FOR PHP | DOCUMENTATION
Of course, restart your server after adding.
EDIT: See also Derick's answer on this StackOverflow page about using a log file to troubleshoot, if the above doesn't work.