PHP 8 with Xdebug 3 on Apple M1

Hits: 242

We can install Xdebug via pecl on MacOS with Homebrew. Paste that in terminal.

pecl install xdebug

And see if the php interpreter with Xdebug working:

d8devs@MBP-von-d8devs project % php -v
PHP 8.0.8 (cli) (built: Jul 12 2021 02:58:53) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies

to correctly configuration Xdebug, locate (or create) section in php.ini file. Finding your currently php.ini location, type this in terminal: php --ini

Open the php.ini file.

vim /opt/homebrew/etc/php/8.0/php.ini

add it as follows at the last lines of file

; List of h....

xdebug.mode = debug
xdebug.client =
xdebug.idekey = PHPSTORM
xdebug.start_with_request = yes

Enjoy! 😊