Mac Os 下搭建LNMP开发环境
参考
遇到的坑:
brew tap homebrew/dupes
brew tap homebrew/versions
需要添加第三方库brew tap homebrew/dupes
的时候,由于有些软件 macOS 已经有了,有一些移动到了homebrew-core
所以不再需要添加了。详见 Homebrew/homebrew-dupes。
These formulae were those that duplicated software provided by macOS.
All formulae were migrated to Homebrew/homebrew-core or deleted.
如果执行这个命令,就会有如下警告:
$ brew tap homebrew/dupes
Warning: homebrew/dupes was deprecated. This tap is now empty as all its formulae were migrated.
Warning: homebrew/versions was deprecated.
同理,还有 homebrew/versions
也不需要添加了。
brew tap homebrew/homebrew-php
出错,需要先执行:
brew untap josegonzalez/php
查看环境PATH:echo $PATH,确认/usr/local/bin, /usr/local/sbin是否存在且排在/usr/sbin之前。如不满足,则需根据你系统所使用的shell,将环境变量添加到~/.bashrc, /.zshrc或/.profile中去:
echo $SHELL
echo 'export PATH="$(brew --prefix php72)/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="$(brew --prefix php72)/sbin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/bin:/usr/local/sbib:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
echo 'export PATH="$(brew --prefix php72)/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="$(brew --prefix php72)/sbin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/bin:/usr/local/sbib:$PATH"' >> ~/.zshrc && . ~/.zshrc
启动PHP-FPM服务
$ brew services start php72
也可通过brew services restart|stop php72命令来重启、停止服务。
配置PHP-FPM随机启动
$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/opt/php/homebrew.mxcl.php.plist ~/Library/LaunchAgents/
验证PHP-FPM服务是否启动成功
$ ps aux | grep php-fpm
如存在相关php-fpm进程,则表明启动成功.
sudo visudo
Change this line FROM:
%admin ALL=(ALL) ALL
TO:
%admin ALL=(ALL) NOPASSWD: ALL
安装git server gogs
echo 'export GOROOT=$HOME/local/go' >> ~/.zshrc
echo 'export GOPATH=$HOME/go' >> ~/.zshrc
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> ~/.zshrc && . ~/.zshrc
转载于:https://www.jianshu.com/p/6f491b03793a
推荐阅读
-
Windows下搭建PHP开发环境(Apache+PHP+MySQL)
-
详解MAC OSX Docker开发环境搭建
-
详解mac下通过docker搭建LEMP环境
-
ubuntu下搭建php开发环境(nginx+(cgi)php5fpm+memcached+xdebug)
-
在MAC上搭建python数据分析开发环境
-
mac下Apache + MySql + PHP搭建网站开发环境
-
Linux下Android开发环境搭建详细步骤
-
Google Earth Engine——windowns下搭建GEE本地python开发环境
-
LNMP环境下搭建yum的方法分析
-
Linux下Android开发环境搭建的操作方法