Mac 用pecl安装xdebug

1.1直接安装sudo pecl install xdebug

出现错误

WARNING: configuration download directory "/tmp/pear/install" is not writeable.  Change download_dir config variable to a writeable dir to avoid this warning


1.2解决:

cd /

cd /tmp/pear

sudo chmod -R 777 install/



WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update

1.3解决

sudo pecl channel-update pecl.php.net
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded
 


Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

1.4解决 安装homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install autoconf


fatal error: 'php.h' file not found
#include "php.h"
         ^~~~~~~
1 error generated.
make: *** [xdebug.lo] Error 1

1.41这里的macOS_10.14.pkg,是自己mac的版本号

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

You should add "zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" to php.ini


1.5将zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so加入t php.ini


1.6重启apache,并测试

sudo apachectl restart

PHP代码

$a = "new string";
xdebug_debug_zval('a');

你可能感兴趣的:(mac)