[SOLVED] XDEBUG & PHP 7.0.8
-
Hi @leokhoa I have difficulties to use XDebug with the last php 7.0.8
I have added to PHP extensions directory, the last version of XDebugfor PHP 7 NTS 32bits.
And in php.ini :[XDebug] zend_extension = php_xdebug.dll xdebug.default_enable = 1 xdebug.remote_autostart = 1
In phpinfo() I could see that XDEBUG is correctly loaded and listen on port 9000.
But I don't success to debuggPHP code in Microsoft Visual Studio Code and its PHP Debug extension:
https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debugWith php 5.6.16 it was working nicely.
Not sure what I am missing here.
-
It is not related to laragon.
But more with my code which generates Exception under PHP 7, so breakpoints are not used(which is strange, breakpoint is before exception)
Breakpoints are working as expected with other php code.
-
Cool. Are you using Microsoft Visual Studio Code instead of Sublime Text ?
I had tried VS Code and was impressed, but I am not sure the trend.
-
Yes I love this software, after using Sublime text, and then Atom, now I'm using exclusively Visual Studo Code.
It's really fast, and almost no need to install any extra plugin to get everything I need for PHP/JS/SASS/CSS.
Compared to Atom which is pretty slow with lots of modules installed.
And Debugging is really pleasant with VSC, I wasn't convinced at all with Xdebug plugin for Sublime & Atom: slow and interface not easy to use.
Here it's working with almost no configuration, and works as a real IDE, breakpoints, call stack, watch...And it's FAST !Usually I'm against using proprietary softwares, except for Microsoft itself, but here it's hard to use anything else.
-
Many thanks for your information. Congrats VS Code. I will try it
-
Regarding my debugging issue with a particular PHP project(other work as expected) and PHP 7.0.
I still don't know why XDebug doesn't stop on my breakpoints set. I'm not sure anymore it is related to PHP exception. because I don't have any now.
I have the same result on Atom and on Visual studio Code.
So I suppose the bug comes from the last version of XDebug 2.4 with PHP 7.I found a workaround, instead of setting breapoint with the editor UI, I insert a call to the php function xdebug_break() where I need to break. and it works as expected.
-
I just tried your last version 2.0.2 with php 7.08 thread safe with the corresponding XDebug version. And breakpoints are now working too on my buggy project
-
You are so patient, man
Look like an issue of Xdebug with PHP 7.0.8 nts
With the way you are doing, no bug can hide
-
Perhaps a stupid thing to ask, but did you use to nts version of xdebug for the nts version of php. I work with xdebug too in php 7.0.9 (and all versions before) and it is working as expected.
(using phpstorm btw)
-
Yes I did use the corresponding version of xdebug. But my problem wasn't that xdebug wasn't working at all. It was working but not for all of my projects.
The issue was that xdebug wasn't stopping at my declared breakpoints but was seeing php notices and warnings.
Switching to thread version of php and xdebug solved my issue.
I will test it with php 7.0.9 to see of it solves my debbuging issue with this particular project.
-
I just tried with PHP 7.0.9NTS & Xdebug NTS PHP 7.0 VC14 with my buggy project and it is working now
To be sure, I rechecked my project with PHP 7.0.8NTS and it is still not working.Good news I will be able to use only PHP NTS
-
Just to be sure, this mis my (part of) php.ini:
[XDebug]
zend_extension = "C:/Development/Laragon/bin/php/php-7.0.8-64-nts/ext/php_xdebug-2.4.0-7.0-vc14-nts-x86_64.dll"
xdebug.idekey = "Intellij"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "C:/Development/Laragon/tmp/xdebug"
xdebug.profiler_output_name = "cachegrind.out.%u-%H_%R"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.var_display_max_depth = 20
xdebug.var_display_max_data = 2048
xdebug.trace_output_dir = "C:/Development/Laragon/tmp/xdebug"
//xdebug.trace_enable_trigger=1
//xdebug.trace_output_name=xdebug.trace.%t.%R
//xdebug.show_mem_delta=1
//xdebug.collect_params=4
//xdebug.collect_return=1
xdebug.trace_format=1
-
How can we switch to PHP non thread safe? Because I dont have xdebug.dll in my ext folder when I installed version 2.0.2.
-
- You need to download the PHP NTS from http://windows.php.net/download
Refer: https://forum.laragon.org/topic/166/tutorial-how-to-add-another-php-version - You can download Xdebug from https://xdebug.org/download.php
- You need to download the PHP NTS from http://windows.php.net/download
-
Got stuck on this myself (specifically running my laravel tests with xdebug from cmd line in vscode).
I was following this tutorial: https://tighten.co/blog/configure-vscode-to-debug-phpunit-tests-with-xdebug which is for mac/linux and as I'm using Laragon/Windows I ended up here.
I did add PHP NTS, but not sure that it was needed. I think it's most likely that the solution was by adding the following options as a minimum in
php.ini
xdebug.remote_enable=On xdebug.remote_host=localhost
This post prompted me to add
xdebug.remote_host=localhost
the https://xdebug.org/archives/xdebug-general/1865.html which made the difference.I also set the env var by running
setx XDEBUG_CONFIG "idekey=VSCODE"
, again not sure if that made the difference or not but was one step I took.Hope this helps someone!