安装homebrew
打开终端,运行这一句:
$ /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
弹出提示:
 这里选择序号1 ,中科大下载源 安装过程中会出现需要密码的情况,输就完了:  接着等待Homebrew 安装完成: 
安装完成后,它会提示你: 重启终端 或者 运行source /Users/.../.zprofile
照做就行了,在命令行运行brew -v ,如果出现如下信息,就说明Homebrew 安装成功 
安装PHP
接下来通过Homebrew 安装php
为啥非得用它来安装,因为在最新的Mac操作系统MacOS Monterey12.0.1中,php已经在xcode中废弃:  运行brew install php 来安装php  漫长地等待过后,最后是这样的:  最后我们在终端运行:php -v ,检查我们是否成功安装php:  如果结果是这样,那就代表我们安装成功了
服务器软件
Mac是自带Apache的 在终端运行:
$ apachectl -v
即可看到我们的服务器版本: 
sudo apachectl start 启动Apache服务sudo apachectl stop 停止Apache服务sudo apachectl restart 重启Apache服务
好了,接下来就可以愉快的使用PHP了!
|