sajad torkamani

Setup prerequisites

Make sure you have the XCode command line tools:

xcode-select --install

Make sure you have PHP installed via Homebrew:

brew install php

Install Xdebug as a PECL extension

pecl install xdebug

Configure xdebug settings

Installing the xdebug PECL extension should enable it by appending a line like zend_extension=xdebug to one of your php.ini files. You can view your loaded php.ini files with php --ini and then search the loaded files for zend_extension=xdebug.

Edit or create a [xdebug] section with the following values:


Make sure to restart your PHP service (e.g., brew services restart php if using PHP installed via Homebrew) and any other PHP service (e.g., a Symfony dev server).

Call phpinfo() somewhere and ensure you see something like the below:

Verify installation was successful

Running php -v should show something like:

PHP 8.1.6 (cli) (built: May 12 2022 23:30:39) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
    with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
    with Zend OPcache v8.1.6, Copyright (c), by Zend Technologie

Notice the with Xdebug line. Running pecl list should also show debug.

Activate debugging

If using browsers, use extensions. You may need to restart your dev server (e.g., Symfony server, Laravel server, etc) after enabling debugging via the extensions.

If using another client like Postman or CURL, use cookies.


Leave a comment

Your email address will not be published. Required fields are marked *