查看PHP
brew search php
image.png
安装PHP
brew install php@7.4
image.png
将PHP加入PATH
打开 .bash_profile
文件
vim ~/.bash_profile
加入
export PATH="$(brew --prefix php@7.4)/bin:$PATH"
执行
source ~/.bash_profile
加入 launchctl 控制启动
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php@7.4/homebrew.mxcl.php@7.4.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php@7.4.plist
启动PHP服务
brew services start php@7.4
image.png
网友评论