m1用homebrew搭载php环境
1.nginx的安装
brew install nginx
找到/opt/homebrew/etc/nginx/nginx.conf,把默认端口改为80,再将
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
替换为fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
brew services start nginx
然后在浏览器中输入localhost,看见welcome为成功
2.php的安装
确保能成功安装,安装前先输入brew update
然后
brew install php@8.1
brew link php@8.1
设置环境变量
echo 'export PATH="/opt/homebrew/opt/php@8.1/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@8.1/sbin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/php@8.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/php@8.1/include"
source ~/.zshrc
然后用php - v查看php版本
brew services start php@8.1
还有一些扩展软件,自行选择是否下载。
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现