Brew
1.打开终端(命令行)
运行 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
安装成功
通过brew 安装的软件 都在 /usr/local/Cellar
3.常用brew命令
brew install 软件名
brew uninstall 软件名
brew list 列出所有安装的软件
具体参考 [https://brew.sh/index_zh-cn.html][1]
Apache
MAC系统再带apache, 我们无需安装,启动就可以了
1.apache 相关命令
sudo apachectl start
sudo apachectl restart
sudo apachectl stop
2.修改主目录
vim /etc/apache2/httpd.conf
修改 DocumentRoot: 你的主目录
PHP7
MAC已经安装了PHP,但是不好控制版本和安装扩展,故我们使用berw安装
1.安装
brew update
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php 加入包含php的包 (brew默认竟然没有PHP的包)
brew install php71 #如果这么安装,php中不会包换libphp7.so 怎么办呢?
brew install php71 —with-httpd24 这样会把apache php7 libphp7一同下载。 apache不是已经装过了吗?
brew uninstall --ignore-dependencies httpd24 #所有把apache再次卸载了。ignore-dependencies 是应为 php安装的时候依赖了http, 所以要卸载加这个
2.配置apache
打开 /ect/apache2/httpd.conf
添加
LoadModule php7_module /usr/local/Cellar/php71/7.1.3_14/libexec/apache2/libphp7.so. #加载libphp7
AddType application/x-httpd-php .php #识别PHP模块
MySQL
1.安装
brew install mysql
2.安装php-mysqli
brew install php71-mysqli
3.登录
mysql -u root -p
4.修改密码
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = ‘localhost’;
flush privileges;
*特别提醒注意的一点是,新版的mysql数据库下的user表中已经没有Password字段了
(完)