martomo / SublimeTextXdebug

Xdebug debugger client for Sublime Text
MIT License
565 stars 89 forks source link

Don't get xdebug to get to breakpoints xampp windows magento 2 #167

Open PabloPlazaLastras opened 7 years ago

PabloPlazaLastras commented 7 years ago

Windows 7 with Sublime 3 (latest version) I installed package thought package control (although I don't know where all the files are, as if I go to Sublime Text -Preferences-Browse Packages I can only see a 'user' folder with some settings, cache and log files) I have an instance of magento2 installed with xampp which is working fine. I placed a test php file in my magento home directory. I went to https://xdebug.org/wizard.php to find out the xdebug dll file to download and place in xampp/php/ext. The file with my configuration is php_xdebug-2.5.0rc1-7.0-vc14.dll I updated my php ini file with:

[XDebug] zend_extension = C:\xampp\php\ext\php_xdebug-2.5.0rc1-7.0-vc14.dll xdebug.remote_enable = 1 xdebug.remote_handler = dbgp xdebug.remote_host = 127.0.0.1 xdebug.remote_port = 9000 xdebug.profiler_append = 0 xdebug.profiler_enable = 0 xdebug.profiler_enable_trigger = 0 xdebug.profiler_output_dir = "C:\xampp\tmp" ; xdebug.profiler_output_name = "xdebug_profile.%R::%u" xdebug.remote_mode = req

I also changed in php.ini to output_buffering = Off although I tried default value which was commented out I created a sublime project file with the following: { "folders": [ { "follow_symlinks": true, "path": "." } ], "settings": { "xdebug": { "url": "http://localhost/magento2", "break_on_exception": [ // E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR "Fatal error", // E_RECOVERABLE_ERROR (since PHP 5.2.0) "Catchable fatal error", // // E_WARNING, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING // "Warning", // // E_PARSE // "Parse error", // // E_NOTICE, E_USER_NOTICE // "Notice", // // E_STRICT // "Strict standards", // // E_DEPRECATED, E_USER_DEPRECATED (since PHP 5.3.0) // "Deprecated", // // 0 // "Xdebug", // // default // "Unknown error" ], } } }

I tried two ways: 1-Breakpoint and 'start debugging' and going to the php file in chrome with the Xdebugger Helper extension set up with the IDE key=SUBLIME.XDEBUG. 2-Breakpoint and start debugging (Launch browser) which takes me to http://localhost/magento2/?XDEBUG_SESSION_START=sublime.xdebug. I manually go to http://localhost/magento2/**test.php**?XDEBUG_SESSION_START=sublime.xdebug. Result for both scenarios is that there is no stop in breakpoint (and no update to the xdebug tabs below in Sublime text), the php file runs completely. (I made sure also that in the second one the Xdebugger Helper extension was disabled, although I tried with extension on also)

I'm getting crazy please help!

tchalvak commented 7 years ago

What I have found is:

See here: http://stackoverflow.com/questions/39027686/xdebug-unable-to-connect-to-client-where-do-i-start-debugging-the-debugger

PabloPlazaLastras commented 7 years ago

Thanks for your response. My 9000 port is definitely open and I can see it 'listening' when I start a debug session in sublime text. It doesn't show when running a netstat -a -n if sublime is closed, so nothing else is using it. changed to 9001 and still the same. I noticed also that in my phpinfo there was the following config: IDE Key=plastras (which is my windows username and I don't really know where is that set) instead of SUBLIME.XDEBUG as it should be, so I changed it on php.ini as xdebug.idekey="SUBLIME.XDEBUG on the xdebug settings but didn't make any difference. Also, I noticed that you commented recently on https://github.com/martomo/SublimeTextXdebug/issues/142 that you tried sublime text and you have the same errors than me on xdebug.log. Did you get it working yourself? it is not clear from the text on that issue. I would try Netbeans or PhpStorm, but I like to start what I have finished and I''m pretty sure xdebug works as port gets open and closed and logs updated...

PabloPlazaLastras commented 7 years ago

BTW, is still @martomo answering to these queries?

tchalvak commented 7 years ago

@PabloPlazaLastras I cannot recommend more highly installing phpStorm and getting xdebug running using phpStorm as a tool with their free trial, because they have a tool that runs through a checklist for you, and it might help clear out some problems. I love sublime, but this is a complicated configuration, and if it doesn't work right away, then you need all the help you can get to debug.

Once it's working in phpstorm, A: It's only about 1 change to the xdebug.idekey and the sublime project file to set it to what should work for sublime text. B: You know that it's not the fault of xdebug configuration.

PabloPlazaLastras commented 7 years ago

I think that the issue is that this plugin doesn't work with PHP 7. I installed again XAMPP version with PHP 5, which includes the php_xdebug.dll file by default (last XAMP with php 7 doesn't have the file and needs to be added as per https://xdebug.org/wizard.php) . It would be great if @martomo could confirm...