Xdebug on macOS 10.13 with PHP 7

牧云@^-^@ 提交于 2019-11-28 09:16:55

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!

Nikolaos Kostopoulos

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:

  1. phpize
  2. ./configure
  3. make
  4. 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

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!