So macOS High Sierra 10.13 now comes with PHP 7.1. While configuring Apache I also created a new /etc/php.ini
from the /etc/php.ini.default
file, m
Ok so I finally got it running myself it works perfectly! I'm assuming that the xdebug binary that comes with macOS High Sierra (found under: /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
) is not compatible with PHP7's new Zend engine.
So I downloaded the latest source from the xdebug website and did the following:
phpize
to configure the build for the new Zend engine;./configure
make
Now the new binary is under modules/xdebug.so
However macOS System Integrity Protection (SIP) will prevent you from overwriting the xdebug.so
under /usr/lib/php/extensions/
. I didn't want to disable this so I created a new directory path under /usr/local/lib/php/extensions/
and copied the new binary to this location. I'm not sure if this directory is the best place to put it or if this is bad practice but it worked for me.
Finally I reconfigured my php.ini to use the new binary and everything worked perfectly!
If you have brew installed with multiple PHP versions i.e. 7.1, 7.2 and 7.3 on Mac OS X mojave, you can to do the following:
Install autoconf with brew brew install autoconf
.
Change to the PHP version that you want Xdebug on, run brew unlink php@7.1 && brew link --force --overwrite php
. This will switch from PHP 7.1 to PHP 7.3.
Download the latest Xdebug source from xdebug website.
Extract the Xdebug tar and navigate to extracted directory, where you'd see all the files.
Run phpize
to configure the build for the new Zend engine.
Run ./configure
.
Run make
.
Xdebug extension xdebug.so
gets compiled in modules
directory.
Create a new directory path under /usr/local/lib/php/7.3.1/extensions/
and copy xdebug.so
to this location. Here, 7.3.1
is the current version that I switched earlier, change this to match your PHP version.
Open php.ini
in an editor and enter
zend_extension="/usr/local/lib/php/7.3.1/extensions/xdebug.so"
then save the change.
Run php -v
and it will show Xdebug has been configured correctly.
If you want to configure Xdebug on another PHP version then just repeat from step 2 all the way to 11. As mentioned in earlier post, this way you don't need to disable/enable System Integrity Protection on Mac OS X.
In order to install it you have to have xcode command line tools.
So you need to run:
xcode-select --install
Then you need to install autoconf:
brew install autoconf
Then you have to download the code from here. After that you have to run in the folder of the source code:
phpize
./configure
make
sudo cp modules/xdebug.so /usr/local/php/extensions
(if the directory doesn't exist go and create it)And finally inside php.ini add
zend_extension=/usr/local/php/extensions/xdebug.so
After that you can enable xdebug inside php.ini and restart apache
sudo apachectl restart
Hello for everyone that got error trying to install xDebug on Mac.
error: unknown type name 'uint64_t'
There are files in your local/bin/include that causes this error. By removing them you get rid of the error. Though, you might have to reinsatall brew.
https://github.com/cython/cython/issues/2009
you made a typo in "zend_extention". this should be zend_extension. and i think the full path is unnecessary zend_extension=xdebug.so should be enough
For anyone arriving late at this party, the initial attempt in the question seems to work just fine in macOS 10.13.6