![]() Once the plugin is installed, we can toggle whether we want to debug a website or not. You can find the latest links on the official website. Next up, we’ll need to install the browser extensions for Xdebug. If you’re searching for a specific line, you can leverage grep as such: $ php -info | grep xdebug.mode remote_enable and remote_port: /usr/local/etc/php/7.4/conf.d/xdebug.ini This will output a whole lot of variables, but you can see all the relevant info, e.g. To verify if Xdebug is set up correctly on the command line, you can run: $ php -info | grep xdebug If the configuration isn’t correct yet, you may need to restart PHP & PHP-FPM, which you can also do like so: $ sudo brew services restart php Go to one of your websites you’ve got setup and add phpinfo() exit to the PHP script, and check that Xdebug is configured correctly there as well by loading the page in your browser. In our main php.ini file, we’ll load the Xdebug extension (this was probably added automatically): $ valet restart If you don’t have the code alias configured, you can use nano: $ nano /usr/ local/etc/php/7.4/conf.d/xdebug.ini ![]() This opens Visual Studio Code for me (I use it for light text editing that doesn’t require PhpStorm). $ code /usr/ local/etc/php/7.4/conf.d/xdebug.ini Since the /usr/local/etc/php/7.4/conf.d directory is scanned automatically, we can put our Xdebug configuration here. I’m creating a new file in the terminal and opening it with Visual Studio Code, but you can do this manually. We’ll create our Xdebug configuration in a separate file. usr/local/etc/php/7.4/conf.d/php-memory-limits.ini ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini, ini files in: /usr/local/etc/php/7.4/conf.dĪdditional. Loaded Configuration File: /usr/local/etc/php/7.4/php.ini Let’s locate that file by typing php -ini, which will tell us where our ini files live: $ php -iniĬonfiguration File (php.ini) Path: /usr/local/etc/php/7.4 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. With Xdebug v3.0.0, Copyright (c) 2002-2020, by Derick Rethans $ pecl install xdebugĪfter running this command, running php -v should say: PHP 7.4.12 (cli) (built: 18:37:21) ( NTS ) 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. With Zend OPcache v7.4.12, Copyright (c), by Zend Technologies Zend Engine v3.4.0, Copyright (c) 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 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. ![]() 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. ![]()
0 Comments
Leave a Reply. |