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.
Related
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...
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
This is my xdebug configuration in my php.ini
[xdebug]
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
xdebug.remote_log = C:\wamp64\logs\xdebug.log
xdebug.idekey = PHPSTORM
xdebug.remote_port = 9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart = on
xdebug.remote_start = on
xdebug.remote_enable = on
xdebug.remote_connect_back = on
it is at the very bottom of the file.
As you can see, I have set the xdebug.idekey to PHPSTORM, but phpinfo() shows that the value is not set, what am I doing wrong?
I also set the idekey through PhpStorm, but why is there no value entry in phpinfo() at the bottom? The top one is filled ?!
EDIT from comments and #Black's answer this is the answer :
WAMP use 3 PHP.ini files :
Apache's file : wamp\bin\apache\apache[version]\bin\php.ini
PHP's file : wamp\bin\php\php[version]\php.ini
Third file : wamp\bin\php\php[version]\phpForApache.ini
First two files are usefull, apache's file is used for HTTP calls, PHP's one for CGI/CLI. The third one is used when your WAMP has 2 PHP's version, WAMP use it for saving the current config and then create a new PHP.ini file for the new version. This happens during the switch of PHP's version.
In the Xdebug's case, indeed it was the apache's file that matter. It's a common issue when the phpinfo don't show any modifications.
If you have the same configuration between those two files, you also can make a symlink from PHP's file to apache one. This will save a lot of headache.
UNLUCKY TRIES
Depends on your request, you may want to configure your server with differents things.
You tried to use Xdebug as remote, then your IDEKEY should be SET as environment variable named : DBGP_IDEKEY
Here's the doc :
xdebug.idekey
Type: string, Default value: complex Controls which IDE Key Xdebug
should pass on to the DBGp debugger handler. The default is based on
environment settings. First the environment setting DBGP_IDEKEY is
consulted, then USER and as last USERNAME. The default is set to the
first environment variable that is found. If none could be found the
setting has as default ''. If this setting is set, it always overrides
the environment variables.
You may be concerned by conditions that I pointed out with italic text
as linked in comment, take a look at the full documentation
I remember that WAMP use Xdebug as an Thread safe extension, you should try to
replace
zend_extension="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
by
zend_extension_ts="C:\wamp64\bin\php\php5.6.35\zend_ext\php_xdebug-2.5.5-5.6-vc11-x86_64.dll"
And check if you have download a correct version of Xdebug (Thread Safe)
Then restart wamp and see if something has changed.
EDIT : You have an issue with your PHP.ini, you're not modifying the right one. I succeeded on mine with this :
; XDEBUG Extension zend_extension = "C:\wamp\bin\php\php7.0.4\zend_ext\php_xdebug-2.4.0-7.0-vc14-x86_64.dll" ;
[xdebug]
xdebug.remote_enable=1
xdebug.idekey = "PHPSTORM"
xdebug.remote_autostart= on
xdebug.remote_connect_back= 1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "c:/wamp/tmp/"
xdebug.collect_params = On
xdebug.show_local_vars = On`
The reason why it was not saved is that on wamp you have to store your config in C:\wamp64\bin\apache\apache_VERSION\bin\php.ini instead of C:\wamp64\bin\php\php_VERSION\php.ini.
I searched my whole wamp/bin/php folder for the occurence of the string xdebug by using Notepad++, thats how I found it out.
I have read and tried what I've found yet I cannot get it to work, it just keeps on hanging at "Waiting for connection (netbeans-xdebug)" when starting debugging.
I do have xdebug installed (I am using wamp) and I've actually managed to get breakpoints working with sublime text 2 (yea that's right!) so the problem is not with php/xdebug on my pc per se but some setting I am missing.
my php.ini for xdebug:
; XDEBUG Extension
[xdebug]
;zend_extension ="c:/wamp64/bin/php/php5.6.25/zend_ext/php_xdebug-2.4.1-5.6-vc11-x86_64.dll"
zend_extension ="c:\wamp64\bin\php\php5.6.25\ext\php_xdebug-2.5.4-5.6-vc11-x86_64.dll"
xdebug.remote_enable = 1
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.remote_hander =dbgp
xdebug.remote_mode = req
xdebug.remote_host =127.0.0.1
xdebug.remote_port = 9000
xdebug.idekey=netbeans-xdebug
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
Netbeans debugging options are set as defaults except I unchecked "stop at first line" coz I read somewhere to do so.
If you need more info on something let me know.
I've found the issue for myself (since everything else seems to be in order on my side), netbeans will not debug non root urls for some reason, and of course I dont want to open the root every time so I've made a virtual host for that specific project with a regular url (www.someurl.com) and it seems to be working fine now.
Also I am not sure every single line is needed from my php.ini xdebug settings but I've kept it so, since I am not bothered to check for redundant lines, so if you are not sure about your xdebug settings just copy the whole thing from my Q.
i'm using PHPStorm and trying to run Xdebug according this video https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/20?autoplay=true.
First part works perfectly (https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/19?autoplay=true), but i'm stuck at second one.
Port 9000 was not working, so i changed it to 10000.
I configured PHP Web Application configuration
and after I press debug button, web is blank
and still loading and PHPStorm is waiting for incoming connection.
I have checked "can accept external connection" at PHP - Debug - Xdebug and xdebug in php.ini configured like this:
[XDebug]
zend_extension="/usr/local/Cellar/php56-xdebug/2.3.3/xdebug.so"
xdebug.remote_enable = 1
xdebug.cli_color = 1
xdebug.show_local_vars = 1
xdebug.remote_port = 10000
xdebug.remote_host= localhost
xdebug.remote_autostart = 1
xdebug.remote_log="/usr/local/tmp/xdebug.log"
xdebug.idekey = "PHPSTORM"
xdebug.ide_key = "PHPSTORM"
xdebug.profiler_enable = 1
xdebug.profiler_output_dir="/usr/local/tmp/xdebug-profiler"
xdebug.profiler_enable_trigger = 1
I tried to validate web server with this result:
I was googling and trying solve this for 6 hours, try to help me please, i`m kind of dummy in this.
Using OS X El Capitan.
I can debug single script, but not a whole website.
When i run this directly online-chef.dev:10000, it says ERR_CONNECTION_REFUSED.
"online-chef.dev" is at local virtual host.
What I am doing wrong?
Thank you so much!
You are tried to debug web page through xdebug. For debug javascript you need install browser extention. This is manual for javascript debugging.
For javascript debug get current extention port and enter in this place:
For XDebug i don't want always click debug button, so i simple enable listen connections. This is manual for XDebug from JetBrains.
Here is my xdebug config that working with listen connections.
xdebug.idekey = "PHPSTORM"
xdebug.remote_port = 9001
xdebug.remote_mode = "req"
xdebug.remote_host = 10.0.2.2
xdebug.remote_handler = "dbgp"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.extended_info = 1
So, when i need debug javascript i click debug button. When i need debug php i just put breakpoint.
First set up debugging instruments often is hard, but it's pays off.