-
Homebrew 国内自动安装脚本
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
也可搜索码云brew,获取最新安装方式(https://gitee.com/cunkai/HomebrewCN)
-
安装PHP
使用brew安装php7.4
brew install [email protected]
替换Mac自带PHP环境并刷新环境变量
brew link [email protected] --force
source ~/.zshrc
-
安装swoole
使用pecl安装swoole
pecl install swoole
注意:开启openssl的时候要加上openssl的路径,不然会提示 fatal error: 'openssl/ssl.h' file not found 错误
enable sockets supports? [no] : yes
enable openssl support? [no] : yes --with-openssl-dir=/usr/local/opt/openssl/
enable http2 support? [no] : yes
enable mysqlnd support? [no] : no
-
安装redis
安装redis服务
brew install redis
安装php-redis扩展
pecl install redis
会提示是否开启igbinary,lzf,zstd三个扩展项,全部yes.
如果报错Cannot find igbinary.h,则安装igbinary模块
pecl install igbinary
-
安装nginx
brew install nginx
启动nginx
brew services start nginx
-
安装mysql
如果要安装mysql5.7则执行brew install [email protected]
brew install mysql
启动mysql
mysql.server start