Xdebug on macOS 10.13 with PHP 7

后端 未结 6 842
失恋的感觉
失恋的感觉 2020-12-05 19:57

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

6条回答
  •  难免孤独
    2020-12-05 20:06

    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!

提交回复
热议问题