1、安装pecl
参考:https://blog.csdn.net/zerovszero1/article/details/98946925
curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
执行以上命令,提示如下错误:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="https://pear.php.net/go-pear.phar">here</a>.</p> </body></html>
更新命令:
1.1下载:curl -O https://pear.php.net/go-pear.phar
1.2安装:sudo php -d detect_unicode=0 go-pear.phar
输入1,回车,配置pear路径为:/usr/local/pear
输入4,回车,配置命令路径为:/usr/local/bin
回车
回车
结束~
1.3查看版本号 pecl -V
2、确认环境
参考:https://blog.csdn.net/u010953609/article/details/101027077
php -v
pecl -V
3. 下载安装包
https://xdebug.org/download.php
cd Downloads/
mkdir xdebug
mv xdebug-latest.tgz xdebug
cd xdebug/
sudo pecl install xdebug-2.9.3.tgz 提示如下错误,需要安装brew。
91 source files, building running: 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: Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize' failed
3.1 安装brew
参考:http://yangjunwei.com/1599.html
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
可能会遇到如下提示的错误:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
额原因不明,反正重试一次好了
出现如下内容,enter,输入密码,等待安装
Press RETURN to continue or any other key to abort Password:
下载需要流量,如果网络不好,就等网络好了再安装吧~
brew -v
3.2 执行 brew install autoconf,
参考:http://yangjunwei.com/2413.html
3.3 继续在xdebug目录中执行 sudo pecl install xdebug-2.9.3.tgz
提示新错误
/private/tmp/pear/install/xdebug/xdebug.c:25:10: fatal error: 'php.h' file not found #include "php.h" ^~~~~~~ 1 error generated. make: *** [xdebug.lo] Error 1 ERROR: `make' failed
然后就重头来了 不知道会不会成功
tar zxf xdebug-2.9.3.tgz
cd xdebug
phpize
./configure
sudo make && make install
一样的错误………………
然后执行xcode-select --install
提示:xcode-select: error: command line tools are already installed, use "Software Update" to install updates
然后又执行
sudo rm -rf /Library/Developer/CommandLineTools
然后再执行xcode-select --install
再弹出的安装提示框中点击安装即可,(需要很久,需要网络佳)
成功后,再执行:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
然而我的电脑目录中 /Library/Developer/CommandLineTools/没有Packages……