

- #XDEBUG 3 IDEKEY INSTALL#
- #XDEBUG 3 IDEKEY UPGRADE#
- #XDEBUG 3 IDEKEY CODE#
- #XDEBUG 3 IDEKEY WINDOWS#
It took about 10 minutes to "install" Remote-WSL into WSL2.

To do this, you can click the Remote-WSL control on the VSCode status bar (bottom left corner) and choose "Reopen Folder in WSL".
#XDEBUG 3 IDEKEY WINDOWS#
I had originally opened my VSCode WSL2 workspace using its Windows network share path \\wsl$\Ubuntu-18.04\srv\I had to reopen the workspace/folder using the Remote - WSL extension. I had to modify both /etc/php/7.3/apache2/php.ini and /etc/php/7.3/cli/php.ini on my system.

Using Ubuntu 20.04, WSL2, Xdebug 3.02 with the VSCode extensions Remote WSL and PHP Debug by Felix Becker. The following worked for me on a PHP project with a single file just to test debugging. Now just set your breakpoints and run the debugger and everything should be working.
#XDEBUG 3 IDEKEY UPGRADE#
See the Xdebug Upgrade for details on changes. SAILXDEBUGMODEdevelop,debug SAILXDEBUGCONFIG' idekeyVSCODE' Restart the containers sail restart. It will revert once the session is complete.Most examples on the web for getting PHP debugging working with VSCode and WSL use Xdebug 2.x php.ini settings. Running this export command will create an environment variable for the current terminal session. This variable flag will inform the Xdebug listener that the script is running. Terminal Create an environment variable for XDEBUG_CONFIG and set the value to 'idekey=VSCODE'. You should now see a step toolbar with the blue arrow buttons greyed out: Here is a good explanation how one IDE implementation uses the idekey. The main thing is it just needs to match. This doesn't actually start the debugging process, but it starts a listener that will be triggered once you run the PHPUnit test. I think as long as your setting on the server and your client (Eclipse or whatever) are the same, it doesnt matter what the value is. Start Debugging by clicking on the green arrow button. Open a PHPUnit test file and set a breakpoint using the debugger plugin. There is no need to modify the default launch.json file. Click on the "config" button (the cogwheel) and select PHP. If you're using PHP 7.1, you can run:įor CLI Remote Debugging, these are all the configuration settings we need in the ext-xdebug.ini file.
#XDEBUG 3 IDEKEY INSTALL#
Install the Xdebug PHP Extension.įor MacOS users, you can easily install the Xdebug extension for your version of PHP using Homebrew. And as per as LazyOne advise, since I am using Xdebug 3 I have change my xdebug. These steps assume that you are running tests on the same machine that you are editing with. zendextensionxdebug xdebug xdebug.modedebug xdebug.discoverclienthost1 xdebug.idekeyVSCODE xdebug.startwithrequestyes xdebug.clientport9003 xdebug.remotehost''. We will need to configure the Xdebug PHP Extension, Visual Studio Code, and your Terminal for this to work. If you're using Laravel Homestead to develop locally, you may want to read this post to get started. After many hours of stumbling around, I found the configuration that works to use Xdebug Remote Debugging with one of the more popular editors out today, Visual Studio Code. However, I want to use it in the terminal by running PHPUnit tests. You can trigger Remote Debugging in two ways:Īlmost all of the resources I have come across for using Xdebug cover the first use case, via the browser. (You can read about all of the Xdebug features here.) In this post, though, I'm focusing on one specific feature called Remote Debugging (a misleading name since we can debug just fine without a remote system). Xdebug is incredibly powerful and has many underutilized features. Why don't more developers use Xdebug in their development workflow?įrom my experience, many developers don't fully understand the Xdebug architecture and its use cases. I am usually enlightened with the inner workings of Laravel, which is an added benefit. The cost and time savings add up quickly! There have also been occasions where, in the process of stepping through client code, I find myself in Laravel's core code.
#XDEBUG 3 IDEKEY CODE#
Using Xdebug, I can step through code while watching values change without having to add a single dd() entry and without the need to run the tests multiple times. However, there are instances where a real debugging setup can improve my efficiency tenfold. Except now, with a bruised ego.ĭon't get me wrong, dd() is a wonderful tool that I will continue to use. Hours later, I end up closing my open browser tabs and going back to littering my codebase with dd(). I think to myself, "There has to be a better way." The next thing I know, I'm researching Xdebug blog posts, reading the documentation, and getting frustrated that I still can't get it to work. The process usually begins with me noticing how often I've been using dd() while re-running my PHPUnit tests. I've lost track of how many hours I have spent trying to configure and use Xdebug.
