12/27/2023 0 Comments Xdebug phpstorm laravel windowsxdebug.mode = > develop = > develop xdebug.client_port = > 9003 = > 9003. 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. Note that this outputs the entire connection to the log, so once you’ve got PhpStorm up and running it’s recommended to turn this off, or you’ll see your disk slowly fill up with a huge logfile!Īfter all this, we’ll need to restart all of Valet, so let’s run: $ valet restart If you need to debug said connection, you can add the following line as well: xdebug. Learn more about the this new configuration setting here. This allows us to specify what we want Xdebug to do depending on the mode of operation Xdebug may do more or less work. In our xdebug.ini file that we just created, we’ll set these: xdebug. In our main php.ini file, we’ll load the Xdebug extension (this was probably added automatically): zend_extension = "xdebug.so" 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. ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini, /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini ini files in: /usr/local/etc/php/7.4/conf.d Additional. Let’s locate that file by typing php -ini, which will tell us where our ini files live: $ php -ini Configuration File (php.ini) Path: /usr/local/etc/php/7.4 Loaded Configuration File: /usr/local/etc/php/7.4/php.ini Scan for additional. 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. 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. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |