But we need to set it up with another port as well.Īdditionally, if you see the following message (“Cannot load Xdebug - it was already loaded”) it’s probably because you have zend_extension="xdebug.so" in your php.ini file twice. Note: If you frequently switch between different versions of PHP, you may want to check out my Mac GUI, PHP Monitor. $ pecl install xdebugĪfter running this command, running php -v should say: PHP 7.4.12 (cli) (built: 18:37:21) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Xdebug v3.0.0, Copyright (c) 2002-2020, by Derick Rethans with Zend OPcache v7.4.12, Copyright (c), by Zend Technologies Next up, we’ll want to make sure to install the latest version of Xdebug via pecl. That means we’re on the right track so far. Let’s also look at PHP: $ php -v PHP 7.4.12 (cli) (built: 18:37:21) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.12, Copyright (c), by Zend Technologies Paths referenced below might differ slightly if your Homebrew installation is located in /opt/homebrew. Note: If you are on an Apple Silicon-based Mac and you installed Homebrew without Rosetta, the Homebrew binaries can be found in /opt/homebrew/bin, as opposed to being located in /usr/local/bin. Let’s make sure php and pecl are installed and linked correctly.Īssuming you use Homebrew, your terminal output will be: $ which php /usr/local/bin/php $ which pecl /usr/local/bin/pecl Setting up Xdebugīefore we begin, I assume you have Laravel Valet installed. If you’re looking to set up a different environment (or would like to see a video), take a look here. Xdebug 3.0 has now been released, and some changes have been made to this guide to reflect this change. This is both for myself for future reference, and for anyone who stumbles upon this post and finds it helpful. These steps should get you up and running without a ton of trial-and-error.After watching a stream where Matt Stauffer and Derick Rethans (the creator of Xdebug) discussed setting up Xdebug with Visual Studio Code, I decided it might be helpful to write a post on setting up Xdebug with PhpStorm, specifically if you’re running Laravel Valet. Stepping through your code with a debugger is a must-have when troubleshooting difficult issues. In Preferences > Languages & Frameworks > PHP > Debug, make sure the Xdebug: Debug port is listening on 9000 (for xdebug2) and 9003 for (xdebug3).The value of /app can be found by doing lando ssh followed by pwd. Map the root by setting the root folder to /app.Expand the files on the left to view the /srv/includes/prepend.php file you added and under “Absolute path on the server” column for the prepend.php file, add /srv/includes/prepend.php.lndo.site url or the port number if using the localhost url. Set Host to localhost and Port to 80/443 if using the.In PHPStorm, go to Preferences > Languages & Frameworks > PHP > Servers.Add a /srv/includes/prepend.php file at the root of the repo (outside the web root).Do a lando rebuild for the changes to take effect.Here’s a step-by-step solution that works for me every time. Getting XDebug working with Lando using PHPStorm can be a bit of a journey as you piece together multiple blog posts and documentation from prior versions of Lando and PHPStorm.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |