Mac Brew安装PHP运行环境
2022/3/4 11:45:07
本文主要是介绍Mac Brew安装PHP运行环境,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、安装homebrew
ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install](https://raw.githubusercontent.com/Homebrew/install/master/install))”
brew常用命令
brew update #更新brew可安装包,建议每次执行一下 brew search php55 #搜索php5.5 brew tap josegonzalez/php #安装扩展<gihhub_user/repo> brew tap #查看安装的扩展列表 brew install php55 #安装php5.5 brew remove php55 #卸载php5.5 brew upgrade php55 #升级php5.5 brew options php55 #查看php5.5安装选项 brew info php55 #查看php5.5相关信息 brew home php55 #访问php5.5官方网站
更换科大源「国外源慢可以更换」
替换brew.git:
cd "$(brew --repo)" git remote set-url origin [https://mirrors.ustc.edu.cn/brew.git](https://mirrors.ustc.edu.cn/brew.git) //替换homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin [https://mirrors.ustc.edu.cn/homebrew-core.git](https://mirrors.ustc.edu.cn/homebrew-core.git)
1.重置源
cd "$(brew --repo)" git remote set-url origin [https://github.com/Homebrew/brew.git](https://github.com/Homebrew/brew.git) //重置homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin [https://github.com/Homebrew/homebrew-core.git](https://github.com/Homebrew/homebrew-core.git)
安装完成后查看brew help看到已安装完成
2、安装Nginx
//查看版本已有版本 brew search Nginx //『在此安装的nginx1.17.6版本』 brew install nginx
安装完成后如下代码
Docroot is: /usr/local/var/www The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. nginx will load all files in /usr/local/etc/nginx/servers/. To have launchd start nginx now and restart at login: brew services start nginx Or, if you dont want/need a background service you can just run: nginx
文件目录:/usr/local/var/www
配置文件:/usr/local/etc/nginx/nginx.conf
虚拟配置:/usr/local/etc/servers/
后台启动:brew services start nginx
验证nginx启动成功:http://localhost:8080(8080端口不需要sudo即可)
3、安装MySQL
brew search mysql
安装MySQL5.7
brew install mysql@5.7 We've installed your MySQL database without a root password. To secure it run: We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -uroot mysql@5.7 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have mysql@5.7 first in your PATH run: echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile For compilers to find mysql@5.7 you may need to set: export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib" export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include" To have launchd start mysql@5.7 now and restart at login: brew services start mysql@5.7 Or, if you don't want/need a background service you can just run: /usr/local/opt/mysql@5.7/bin/mysql.server start ==>Summary
这篇关于Mac Brew安装PHP运行环境的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-19php8的协程和hyperf的协程有什么区别?-icode9专业技术文章分享
- 2024-12-19php8 的fiber是什么?-icode9专业技术文章分享
- 2024-12-05怎么在php8,1 里面开启 debug?-icode9专业技术文章分享
- 2024-12-05怎么在php8,1 里面开启 debug?-icode9专业技术文章分享
- 2024-11-29使用PHP 将ETH账户的资产汇集到一个账户
- 2024-11-23怎么实现安卓+php 热更新方案?-icode9专业技术文章分享
- 2024-11-22PHP 中怎么实现判断多个值是否为空、null 或者为 false?-icode9专业技术文章分享
- 2024-11-11开源 PHP 商城项目 CRMEB 二次开发和部署教程
- 2024-11-09怎么使用php在kaufland平台刊登商品?-icode9专业技术文章分享
- 2024-11-05PHP的抽象类和接口是什么,有什么区别-icode9专业技术文章分享