LNMP
nginx
brew install nginx
UpdatingHomebrew...
==>Downloadinghttps://homebrew.bintray.com/bottles/nginx-1.10.3.sierra.bottle.tar.gz
Alreadydownloaded:/Users/mini/Library/Caches/Homebrew/nginx-1.10.3.sierra.bottle.tar.gz
==>Pouringnginx-1.10.3.sierra.bottle.tar.gz
==>Usingthe sandbox
==>Caveats
Docrootis:/usr/local/var/www
Thedefaultport has been setin/usr/local/etc/nginx/nginx.conf to 8080so that
nginx can run without sudo.
nginx will load all files in/usr/local/etc/nginx/servers/.
Tohave launchd start nginx now andrestart at login:
brew services start nginx
Or,ifyou don't want/need a background service you can just run:
nginx
==> Summary
🍺 /usr/local/Cellar/nginx/1.10.3: 8 files, 980.9K#重新加载配置|重启|停止|退出 nginx
nginx -s reload|reopen|stop|quit
#测试配置是否有语法错误
nginx -t
Mysql
brew install mysql
==>Downloadinghttps://homebrew.bintray.com/bottles/mysql-5.7.17.sierra.bottle.1.tar.gz
Alreadydownloaded:/Users/mini/Library/Caches/Homebrew/mysql-5.7.17.sierra.bottle.1.tar.gz
==>Pouringmysql-5.7.17.sierra.bottle.1.tar.gz
==>Usingthe sandbox
==>Caveats
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
==>Summary
🍺/usr/local/Cellar/mysql/5.7.17:321files,234.4M
PHP5.6
brew install php56 --with-imap --with-tidy --with-debug --with-mysql --with-fpm
UpdatingHomebrew...
==>Installingphp56 fromjosegonzalez/php
==>Installingdependencies forjosegonzalez/php/php56:imap-uw
==>Installingjosegonzalez/php/php56 dependency:imap-uw
==>Downloadinghttps://homebrew.bintray.com/bottles/imap-uw-2007f.sierra.bottle.tar.gz
######################################################################## 100.0%
==>Pouringimap-uw-2007f.sierra.bottle.tar.gz
🍺/usr/local/Cellar/imap-uw/2007f:151files,9.0M
Warning:josegonzalez/php/php56:thisformula has no--with-fpm option so it will be ignored!
Warning:josegonzalez/php/php56:thisformula has no--with-mysql option so it will be ignored!
Warning:josegonzalez/php/php56:thisformula has no--with-tidy option so it will be ignored!
==>Installingjosegonzalez/php/php56 --with-debug --with-imap
==>Downloadinghttps://php.net/get/php-5.6.29.tar.bz2/from/this/mirror
==>Downloadingfromhttps://secure.php.net/distributions/php-5.6.29.tar.bz2
######################################################################## 100.0%
==>./configure --prefix=/usr/local/Cellar/php56/5.6.29_5 --localstatedir=/usr/local/var--sysconfdir=/usr/local/etc/php/5.6--with-config-fil
==>make
==>make install
==>Caveats
Thephp.ini file can be found in:
/usr/local/etc/php/5.6/php.ini
✩✩✩✩Extensions✩✩✩✩
Ifyou are having issues withcustom extension compiling,ensurethat
you are usingthe brew version,byplacing /usr/local/bin before /usr/sbin inyour PATH:
PATH="/usr/local/bin:$PATH"
PHP56 Extensionswill always be compiled against thisPHP.Pleaseinstall them
using--without-homebrew-php to enable compiling against system PHP.
✩✩✩✩PHP CLI ✩✩✩✩
Ifyou wish to swap the PHP you useon the command line,you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile oryour shell's equivalent configuration file:
export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"
✩✩✩✩ FPM ✩✩✩✩
To launch php-fpm on startup:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
The control script is located at /usr/local/opt/php56/sbin/php56-fpm
OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:
PATH="/usr/local/sbin:$PATH"
You may also need to edit the plist to use the correct "UserName".
Please note that the plist was called 'homebrew-php.josegonzalez.php56.plist' in old versions
of this formula.
With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system
you have to install php with the --with-httpd24 option. See brew options php56 for more details.
To have launchd start josegonzalez/php/php56 now and restart at login:
brew services start josegonzalez/php/php56
==> Summary
🍺 /usr/local/Cellar/php56/5.6.29_5: 331 files, 43.1M, built in 7 minutes 7 seconds
php-fpm -t 测试php-fpm配置
重启php-fpm:
killall php-fpm
/usr/local/sbin/php-fpm
相关服务
停止自带的apache:
sudo apachectl stop
or
sudo lsof -i -P | grep 80
orTrythis
`which apachectl`
on mymavericks I get
`/usr/sbin/apachectl`
then
`sudo /usr/sbin/apachectl stop`
brew tap
brew tap josegonzalez/homebrew-php
UpdatingHomebrew...
==>Auto-updated Homebrew!
Updated2taps (homebrew/core,josegonzalez/php).
==>NewFormulae
ktmpl
==>UpdatedFormulae
certigo jigdo josegonzalez/php/php55-redis mysql-cluster wolfssl
digdag josegonzalez/php/php53-redis josegonzalez/php/php56-redis skinny yank
embulk josegonzalez/php/php54-redis josegonzalez/php/php71-redis swiftgen
composer
➜~brew install josegonzalez/php/composer
==>Installingcomposer fromjosegonzalez/php
==>Downloadinghttps://homebrew.bintray.com/bottles-php/composer-1.3.2.sierra.bottle.tar.gz
######################################################################## 100.0%
==>Pouringcomposer-1.3.2.sierra.bottle.tar.gz
🍺/usr/local/Cellar/composer/1.3.2:5files,1.7M
crontab
crontab -e 编写定时任务
crontab -l 查看定时任务
log
/usr/local/var/log/...
php-xdebug(报异常)
➜~brew install php56-xdebug
UpdatingHomebrew...
==>Auto-updated Homebrew!
Updated2taps (homebrew/core,homebrew/dupes).
==>NewFormulae
git-quick-stats uftp
==>UpdatedFormulae
aha buku compcert geoserver gst-plugins-basehomebrew/dupes/ed libhdhomerun mosquitto putty tile38
akka bullet crystal-lang gitlab-ci-multi-runner gst-plugins-good imagemagick libphonenumber mpd qca vim
arangodb casperjs curl gnome-autoar gst-plugins-ugly jenkins libsigsegv node ringojs wakatime-cli
aws-sdk-cpp charm direnv gradle gst-python jump mecab-jumandic node-build rust xonsh
awscli cheops docker-compose gst-editing-services gst-rtsp-server kerl mitmproxy nvm sops yaz
azure-cli cjdns docker-compose-completion gst-libav gst-validate kobalt mkvtoolnix osc svtplay-dl youtube-dl
bee coffeescript elixirscript gst-plugins-bad gstreamer libarchive mongo-orchestration parallel terragrunt zstd
==>RenamedFormulae
protobuf250 ->protobuf@2.5protobuf260 ->protobuf@2.6
==>DeletedFormulae
malaga probatron4j rtpbreak suomi-malaga-voikko
==>Installingphp56-xdebug fromjosegonzalez/php
==>Downloadinghttps://homebrew.bintray.com/bottles-php/php56-xdebug-2.5.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==>Pouringphp56-xdebug-2.5.0.sierra.bottle.tar.gz
==>Caveats
Tofinish installing xdebug forPHP 5.6:
*/usr/local/etc/php/5.6/conf.d/ext-xdebug.ini was created,
donotforget to remove it upon extension removal.
*Validateinstallation via one of the following methods:
*
*UsingPHP froma webserver:
*-Restartyour webserver.
*-Writea PHP page that calls "phpinfo();"
*-Loadit ina browser andlook forthe info on the xdebug module.
*-Ifyou see it,you have been successful!
*
*UsingPHP fromthe command line:
*-Run`php -i "(command-line 'phpinfo()')"`
*-Lookforthe info on the xdebug module.
*-Ifyou see it,you have been successful!
==>Summary
🍺/usr/local/Cellar/php56-xdebug/2.5.0:3files,194.1K
autoconf
➜~brew install autoconf
UpdatingHomebrew...
==>Downloadinghttps://homebrew.bintray.com/bottles/autoconf-2.69.sierra.bottle.4.tar.gz
######################################################################## 100.0%
==>Pouringautoconf-2.69.sierra.bottle.4.tar.gz
==>Caveats
EmacsLispfiles have been installed to:
/usr/local/share/emacs/site-lisp/autoconf
==>Summary
🍺/usr/local/Cellar/autoconf/2.69:70files,3.0M
PHP多版本
➜~brew install php70 --without-apache --with-fpm
UpdatingHomebrew...
==>Auto-updated Homebrew!
Updated1tap (homebrew/core).
==>UpdatedFormulae
couchdb-lucene fonttools harfbuzz json-fortran meson
==>Installingphp70 fromjosegonzalez/php
Error:Cannotinstall josegonzalez/php/php70 because conflicting formulae are installed.
php56:because different php versions install the same binaries.
Please`brew unlink php56`before continuing.
Unlinkingremoves a formula's symlinks from /usr/local. You can
link the formula again after the install finishes. You can --force this
install, but the build may fail or cause obscure side-effects in the
resulting software.
➜ ~ brew unlink php56
Unlinking /usr/local/Cellar/php56/5.6.29_5... 17 symlinks removed
➜ ~ brew install php70
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
midnight-commander protobuf-swift vegeta
==> Installing php70 from josegonzalez/php
==> Installing dependencies for josegonzalez/php/php70: readline
==> Installing josegonzalez/php/php70 dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.3.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-7.0.3.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
🍺 /usr/local/Cellar/readline/7.0.3: 46 files, 2M
==> Installing josegonzalez/php/php70
==> Downloading https://homebrew.bintray.com/bottles-php/php70-7.0.15_8.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring php70-7.0.15_8.sierra.bottle.tar.gz
==> Caveats
The php.ini file can be found in:
/usr/local/etc/php/7.0/php.ini
✩✩✩✩ Extensions ✩✩✩✩
If you are having issues with custom extension compiling, ensure that
you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:
PATH="/usr/local/bin:$PATH"
PHP70 Extensions will always be compiled against this PHP. Please install them
using --without-homebrew-php to enable compiling against system PHP.
✩✩✩✩ PHP CLI ✩✩✩✩
If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile or your shell's equivalent configuration file:
exportPATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
✩✩✩✩FPM ✩✩✩✩
Tolaunch php-fpm on startup:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php70/homebrew.mxcl.php70.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
Thecontrol script islocated at /usr/local/opt/php70/sbin/php70-fpm
OS X 10.8andnewer come withphp-fpm pre-installed,to ensureyou are usingthe brew version you need to make sure /usr/local/sbin isbefore /usr/sbin inyour PATH:
PATH="/usr/local/sbin:$PATH"
Youmay also need to edit the plist to usethe correct "UserName".
Pleasenote that the plist was called 'homebrew-php.josegonzalez.php70.plist'inold versions
of thisformula.
Withthe release of macOS Sierrathe Apachemoduleisnow notbuilt bydefault.Ifyou want to build it on your system
you have to install php withthe --with-httpd24 option.Seebrew options php70 formore details.
Tohave launchd start josegonzalez/php/php70 now andrestart at login:
brew services start josegonzalez/php/php70
==>Summary
🍺/usr/local/Cellar/php70/7.0.15_8:332files,38.8M
php-version
➜~brew install php-version
UpdatingHomebrew...
==>Installingphp-version fromjosegonzalez/php
==>Downloadinghttps://homebrew.bintray.com/bottles-php/php-version-0.12.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==>Pouringphp-version-0.12.1.sierra.bottle.tar.gz
==>Caveats
Addthe following to $HOME/.bashrc,$HOME/.zshrc,oryour shell's equivalent configuration file:
source $(brew --prefix php-version)/php-version.sh && php-version 5
It is recommended that you install versions of PHP via homebrew as depicted below:
brew install php56
brew unlink php56
Type `php-version --help` for more configuration options.
==> Summary
🍺 /usr/local/Cellar/php-version/0.12.1: 6 files, 15.6K
➜ ~ sudo vim ~/.zshrc
➜ ~ source $(brew –prefix php-version)/php-version.sh && php-version 5
➜ ~ php-version
5.6.29
7.0.15
➜ ~ php -v
PHP 5.6.29 (cli) (built: Feb 20 2017 18:27:53) (DEBUG)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
➜ ~ php-version 7
➜ ~ php -v
PHP 7.0.15 (cli) (built: Jan 22 2017 08:51:45) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
➜ ~ php-version 5
➜ ~ php -v
PHP 5.6.29 (cli) (built: Feb 20 2017 18:27:53) (DEBUG)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
MongoDb
➜~brew install mongodb
UpdatingHomebrew...
==>Auto-updated Homebrew!
Updated2taps (homebrew/core,homebrew/dupes).
==>NewFormulae
bit dmtx-utils sha1dc
==>UpdatedFormulae
aptly-completion grails pdfgrep
armor grpc pgcli
aws-sdk-cpp hg-flow proselint
awscli hledger protobuf-swift
bash-completion hyper pyinvoke
byteman i3status reposurgeon
cake iperf3 rmlint
cassandra ipfs selenium-server-standalone
certigo jenkins spdlog
conan jrnl sqlparse
consul-backinator khal stout
convox kompose svgcleaner
crystal-icr kubernetes-helm swiftformat
crystal-lang ldc swiftplate
csvtomd libav swimat
curlpp libbluray syncthing
dosfstools libosmium tarsnapper
eralchemy linkerd timelimit
eventql mandoc todolist
excel-compare metricbeat todoman
feedgnuplot mighttpd2 tundra
gcc@4.9minimesos typescript
git-lfs newlisp vert.x
git-quick-stats nexus vim
gnutls p11-kit yle-dl
goaccess packetbeat youtube-dl
gofabric8 paket
==>RenamedFormulae
bash-completion2 ->bash-completion@2 mariadb100 ->mariadb@10.0
==>DeletedFormulae
ctorrent s3sync
==>Downloadinghttps://homebrew.bintray.com/bottles/mongodb-3.4.2.sierra.bottle.1.ta
############## 20.7%
curl:(18)transfer closed with74649928bytes remaining to read
Error:Failedto download resource "mongodb"
Downloadfailed:https://homebrew.bintray.com/bottles/mongodb-3.4.2.sierra.bottle.1.tar.gz
Warning:Bottleinstallation failed:building fromsource.
==>Installingdependencies formongodb:go,scons
==>Installingmongodb dependency:go
==>Downloadinghttps://homebrew.bintray.com/bottles/go-1.8.sierra.bottle.tar.gz
######################################################################## 100.0%
==>Pouringgo-1.8.sierra.bottle.tar.gz
==>Caveats
A valid GOPATH isrequired to usethe `go get`command.
If$GOPATH isnotspecified,$HOME/go will be used bydefault:
https://golang.org/doc/code.html#GOPATH
Youmay wish to add the GOROOT-based install location to your PATH:
exportPATH=$PATH:/usr/local/opt/go/libexec/bin
==>Summary
🍺/usr/local/Cellar/go/1.8:7,017files,281.6MB
==>Installingmongodb dependency:scons
==>Downloadinghttps://homebrew.bintray.com/bottles/scons-2.5.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==>Pouringscons-2.5.1.sierra.bottle.tar.gz
🍺/usr/local/Cellar/scons/2.5.1:209files,2.2MB
==>Usingthe sandbox
==>Downloadinghttps://fastdl.mongodb.org/src/mongodb-src-r3.4.2.tar.gz
######################################################################## 100.0%
==>Cloninghttps://github.com/mongodb/mongo-tools.git
Cloninginto'/Users/mini/Library/Caches/Homebrew/mongodb--github.com-mongodb-mongo-tools--git'...
remote:Countingobjects:20140,done.
remote:Compressingobjects:100%(47/47),done.
remote:Total20140(delta 22),reused 0(delta 0),pack-reused 20092
Receivingobjects:100%(20140/20140),9.56MiB|382.00KiB/s,done.
Resolvingdeltas:100%(9926/9926),done.
Note:checking out'17fbdf31abca50cdfe27482b05b1476f42ecab0a'.
Youare in'detached HEAD'state.Youcan look around,make experimental
changes andcommit them,andyou can discard any commits you make inthis
state without impacting any branches byperforming another checkout.
Ifyou want to create a newbranch to retain commits you create,you may
doso (now orlater)byusing-b withthe checkout command again.Example:
git checkout -b
==>Checkingouttag r3.4.2
==>./build.sh ssl
==>/usr/local/opt/scons/bin/scons install --prefix=/usr/local/Cellar/mongodb/3.4.2-j4 --osx-version-min=10.12CC=/usr/bin/clang CXX=/usr/bin/clang++--use-new-tools --disable-warnings-as-errors --ssl CCFLAGS=-I/usr/local/opt/openssl/include LINKFLAGS=-L/usr/local/opt/op
==>Caveats
Tohave launchd start mongodb now andrestart at login:
brew services start mongodb
Or,ifyou don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
🍺 /usr/local/Cellar/mongodb/3.4.2: 17 files, 266.5MB, built in 45 minutes 46 seconds
brew untap josegonzalez/php
brew tap –repair
brew update
brew tap homebrew/php
php-mongodb
➜vhost brew install php56-mongodb
UpdatingHomebrew...
==>Auto-updated Homebrew!
Updated1tap (homebrew/core).
==>UpdatedFormulae
alot aws-sdk-cpp awscli botan doitlive jid kubernetes-cli lxc mikutter monit monotone softhsm sourcery vim
==>Installingphp56-mongodb fromjosegonzalez/php
==>Downloadinghttps://homebrew.bintray.com/bottles-php/php56-mongodb-1.2.5.sierra.bottle.tar.gz
######################################################################## 100.0%
==>Pouringphp56-mongodb-1.2.5.sierra.bottle.tar.gz
==>Caveats
Tofinish installing mongodb forPHP 5.6:
*/usr/local/etc/php/5.6/conf.d/ext-mongodb.ini was created,
donotforget to remove it upon extension removal.
*Validateinstallation via one of the following methods:
*
*UsingPHP froma webserver:
*-Restartyour webserver.
*-Writea PHP page that calls "phpinfo();"
*-Loadit ina browser andlook forthe info on the mongodb module.
*-Ifyou see it,you have been successful!
*
*UsingPHP fromthe command line:
*-Run`php -i "(command-line 'phpinfo()')"`
*-Lookforthe info on the mongodb module.
*-Ifyou see it,you have been successful!
==>Summary
🍺/usr/local/Cellar/php56-mongodb/1.2.5:3files,656.3KB
brew services start mongo
brew services stop mongo
mongo DB config:/usr/local/etc/mongo.conf
mongo DB path:/data/db
mongo DB log:/usr/local/var/log/mongo.log
ps aux|grep php
killall php
make
make clean
make test
sudo make install
ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/