Xdebug on MACos 10.13 with PHP 7

Xdebug on macOS 10.13 with PHP 7

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:

  1. Installed autoconf with brew;
  2. Run phpize to configure the build for the new Zend engine;
  3. Run ./configure
  4. Run 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!

How to setup XDebug for PHP7 on Mac?

As stated by Homebrew, Homebrew/php tag was deprecated.

So it's not possible to install xdebug through Homebrew anymore. Please use PECL instead: https://xdebug.org/docs/install#pecl

How to use xdebug with MAC High Sierra standard installation

The solution:

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1

Then I copied xdebug.so into my extension directory.

XDebug not working on MacOS High Sierra : Symbol not found: _xdebug_monitored_function_dtor

look at this answer: https://stackoverflow.com/a/46623845/6540060

you need to compile your own xdebug.so

macOS 10.13 Server app v5.6 PHP Downgrade From 7 to 5

I do not recommend downgrading the version, I would install PHP 5.6 using homebrew and then just having both versions installed.
brew install php56

This will be symlinked from /usr/local/Cellar/php56 into /usr/local/bin and as long as this in in your $PATH then you should be able to use PHP 5.6 without overriding 7

Failed-loading xdebug installation - xdebug.so, 9 no suitable image found

I sorted the problem out by adding

export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"

on .bash_profile.

PHP 7.1 came with OSX 10.13.2, so default path was set to the pre-packed php, which shows the error on phpinfo.



Related Topics



Leave a reply



Submit