Skip to content

Instantly share code, notes, and snippets.

@imranfakhrul
Created January 5, 2024 12:28
Show Gist options
  • Save imranfakhrul/a4c608caf5ce515c122b910fdaa792cd to your computer and use it in GitHub Desktop.
Save imranfakhrul/a4c608caf5ce515c122b910fdaa792cd to your computer and use it in GitHub Desktop.
Install Xdebug for different PHP versions
While developing/testing projects in different PHP versions, I got overwhelmed by running Xdebug for every PHP version. I just want everything to be set and switch php versions and use Xdebug right away!
I use PHP 7.4, 8.0, 8.1, 8.2, 8.3 in Mac environment.
I use Herd to run PHP.
Steps to install Xdebug for every version
For 7.4
Install php@7.4 using brew
Install pecl
pecl install xdebug-3.1.6
Move the xdebug.so file to somewhere else ($HOME/xdebug/3.1.6)
Add this absolute path to php.ini
zend_extension=/path/to/xdebug.so
For 8.0
brew unlink php@7.4
brew link php@8.0
pecl install xdebug (May need to add -f flag to force install)
Move the xdebug.so file to somewhere else ($HOME/xdebug/3.3.1)
Add this absolute path to php.ini
zend_extension=/path/to/xdebug.so
Do the same for every PHP version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment