- 下载xdebug文件
1.将phpinfo();的信息全部输入网址中的框,得到适配的xdebug版本:
网址:http://xdebug.org/wizard.php
2.下载并解压
sudo tar -zxvf xdebug-2.7.0.tgz
cd xdebug xdebug-2.7.0
3.配置
configure
make
执行make报错
/bin/sh /Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/libtool --mode=compile cc -I. -I/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0 -DPHP_ATOM_INC -I/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/include -I/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/main -I/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/xdebug.c -o xdebug.lo
mkdir .libs
cc -I. -I/Users/xuce/Downloads/xdebug-2.7.0/xdebug-2.7.0 -DPHP_ATOM_INC -I/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/include -I/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/main -I/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/xdebug.c -fno-common -DPIC -o .libs/xdebug.o
/Users/Downloads/xdebug-2.7.0/xdebug-2.7.0/xdebug.c:25:10: fatal error: 'php.h' file not found
#include "php.h"
^~~~~~~
1 error generated.
make: *** [xdebug.lo] Error 1
执行
brew doctor
brew link --overwrite php
//执行完后,重新执行phpize
phpize
./configure --with-php-config=/usr/bin/php-config
问题得以解决
修改php.ini增加
zend_extension=/usr/local/lib/php/pecl/20170718/xdebug.so
然后重启php-fpm
php -m 查看是否安装成功