mac brew 安装 php 环境
548 brew search php
549 brew tap homebrew/dupes
550 brew tap josegonzalez/homebrew-php
551 brew search php
552 brew install php56 --with-imap --with-tidy --with-debug --with-mysql --with-fpm
554 history | grep brew
bogon:etc xingchong$
bogon:etc xingchong$
bogon:etc xingchong$ brew install php56 --with-imap --with-tidy --with-debug --with-mysql --with-fpm
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Installing php56 from josegonzalez/php
==> Installing dependencies for josegonzalez/php/php56: libpng, freetype, gettext, icu4c, imap-uw, jpeg, libxml2, libtool, unixodbc, readline
==> Installing josegonzalez/php/php56 dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.34.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.6.34.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/libpng/1.6.34: 26 files, 1.2MB
==> Installing josegonzalez/php/php56 dependency: freetype
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.9.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring freetype-2.9.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/freetype/2.9: 60 files, 2.7MB
==> Installing josegonzalez/php/php56 dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gettext-0.19.8.1.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/gettext/lib
CPPFLAGS: -I/usr/local/opt/gettext/include
==> Summary
🍺 /usr/local/Cellar/gettext/0.19.8.1: 1,934 files, 16.9MB
==> Installing josegonzalez/php/php56 dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-60.2.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring icu4c-60.2.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/icu4c/lib
CPPFLAGS: -I/usr/local/opt/icu4c/include
==> Summary
🍺 /usr/local/Cellar/icu4c/60.2: 249 files, 67MB
==> Installing josegonzalez/php/php56 dependency: imap-uw
==> Downloading https://homebrew.bintray.com/bottles/imap-uw-2007f.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring imap-uw-2007f.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/imap-uw/2007f: 151 files, 9.0MB
==> Installing josegonzalez/php/php56 dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9b.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring jpeg-9b.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/jpeg/9b: 20 files, 724KB
==> Installing josegonzalez/php/php56 dependency: libxml2
==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.7.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libxml2-2.9.7.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/libxml2/lib
CPPFLAGS: -I/usr/local/opt/libxml2/include
If you need Python to find bindings for this keg-only formula, run:
echo /usr/local/opt/libxml2/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/libxml2.pth
mkdir -p /Users/xingchong/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/xingchong/Library/Python/2.7/lib/python/site-packages/homebrew.pth
==> Summary
🍺 /usr/local/Cellar/libxml2/2.9.7: 281 files, 10.4MB
==> Installing josegonzalez/php/php56 dependency: libtool
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libtool-2.4.6_1.sierra.bottle.tar.gz
==> Caveats
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
🍺 /usr/local/Cellar/libtool/2.4.6_1: 70 files, 3.7MB
==> Installing josegonzalez/php/php56 dependency: unixodbc
==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.5_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring unixodbc-2.3.5_1.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/unixodbc/2.3.5_1: 43 files, 1.8MB
==> Installing josegonzalez/php/php56 dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.3_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-7.0.3_1.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because 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_1: 46 files, 1.5MB
Warning: josegonzalez/php/php56: this formula has no --with-fpm option so it will be ignored!
Warning: josegonzalez/php/php56: this formula has no --with-mysql option so it will be ignored!
Warning: josegonzalez/php/php56: this formula has no --with-tidy option so it will be ignored!
==> Installing josegonzalez/php/php56 --with-debug --with-imap
==> Downloading https://php.net/get/php-5.6.33.tar.bz2/from/this/mirror
==> Downloading from https://secure.php.net/get/php-5.6.33.tar.bz2/from/this/mirror
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/php56/5.6.33_9 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.6 --with-config-file-pa
==> make
==> make install
==> Caveats
The php.ini file can be found in:
/usr/local/etc/php/5.6/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"
PHP56 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:
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-httpd 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.33_9: 331 files, 42.7MB, built in 7 minutes 10 seconds
bogon:etc xingchong$
bogon:etc xingchong$
bogon:etc xingchong$
bogon:etc xingchong$
bogon:etc xingchong$
bogon:etc xingchong$
bogon:etc xingchong$
bogon:etc xingchong$ php -v
PHP 5.6.31 (cli) (built: Jul 10 2017 07:55:18)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
bogon:etc xingchong$
bogon:etc xingchong$