Tag Archives: macos

Install PHP 7.3 + xdebug on MacOS Mojave (with homebrew)

First, you need to have homebrew installed, if you don’t have it please go to https://brew.sh/ and follow the installation steps.

Remove any old version of php:

brew list | grep php | awk '{ print "brew uninstall --force "$1}' | bash

To be sure, manually remove the php cellar folder:

rm -rf /usr/local/Cellar/php

Then clean any php tap (extra repo):

brew untap homebrew/php

Cleanup and Update your brew:

brew cleanup
brew update

Install the latest version of php:

brew install php

Clean up old xdebug:

pecl uninstall xdebug

Install the latest version of xdebug-beta (The xdebug is not compatible with 7.3 so you need to use the xdebug-beta):

pecl install xdebug-beta

The last step, edit the  /usr/local/etc/php/7.3/php.ini and add these lines at the bottom of this file:

zend_extension=xdebug.so
[XDebug]
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000