1.安装命令latestversion8.0.xbrewinstallphpbrewupgradephpversioncontrol:switchto7.4brewinstallphp@7.4brewlink--overwritephp@7.4#.zshrcexportPATH="$PATH:/usr/local/opt/php@7.4/bin:/usr/local/opt/php@7.4/sbin"扩展应该首先尝试peclinstallxx来安装。失败时的情况:如:swoole,uuid,以下是踩坑的经验。-uuidbrew安装util-linuxprintf"/usr/local/opt/util-linux"|sudopeclinstalluuid2.fatalerror:'php.h'filenotfound百度解决:brewdoctor&&brewlink--overwritephp[修复系统链接],问题依旧。下面是sdebug安装的例子:gitclonegit@github.com:swoole/sdebug.git-bsdebug_2_9--depth=1cdsdebugphpize./configuremakecleanmakemakeinstall找到php.h之类的,缺少的补上或者去官网下载当前版本的php解压,复制对应目录cp-r/usr/local/include/php/sdebugmake找到.-namezend.hcp./Zend/*.make查找。-nameTSRM.hcp./TSRM/*.make成功,继续makeinstallll/usr/local/Cellar/php/7.4.12/lib/php/20190902/,可以看到xdebug.so已经准备好了,添加即可它。总体就是cp-r/usr/local/include/php/sdebug&&cp./Zend/*。&&cp./TSRM/*.然后重新make,在php.ini中加入:zend_extension=php_xdebug调试《沈唁: Swoole 如何使用 Xdebug 进行单步调试》3。swoole升级phpbrew安装php||brewupgradephp如果php-v环境版本不对:brewinfophp#显示安装目录/usr/local/opt/php@8.0vim~/.bash_profileexportPATH="/usr/local/opt/php@8.0/bin:/usr/local/opt/php@8.0/sbin:$PATH"source~/.bash_profileinstallswoolegitclonehttps://gitee.com/swoole/swoole.gitcdswoole/&&phpize#brewinstallopenssl&&brewinfoopenssl./configure--with-php-config=/usr/local/opt/php@8.0/bin/php-config--with-openssl-dir=/usr/local/opt/openssl@1.1--enable-http2--enable-socketsmake&&makeinstallecho'extension=swoole'>>/usr/local/etc/php/8.0/php.ini
