环境:MacOS Catalina 10.15
pecl 方式安装
pecl install xdebug
报错:
phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
尝试了N种方法,以失败告终。。
不过看网上资料,有人解决了这个问题。参考:macos高版本安装php扩展报错
使用 MacOS 自带的 xdebug.so
真是踏破铁鞋无觅处。系统本身就已经自带 xdebug 模块。只需要 php.ini 开启即可。
sudo vi /etc/php.ini
添加 xdebug 配置
[xdebug]
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_port=9001
xdebug.remote_host=127.0.0.1
xdebug.idekey=PHPSTORM
PhpStorm 配置:
菜单:Preferences | Languages & Frameworks | PHP | Debug
将 Debug port 改为 9001 即可。