$ brew install php56 \--without-snmp \--without-Apache \--with-debug \--with-fpm \ --with-intl \--with-homebrew-curl \--with-homebrew-libxslt \--with-homebrew-openssl \--with-imap \--with-mysql \--with-tidy
首先安裝依賴擴充:curl,libpng,freetype,gettext,h等。
==> Installing php56 from homebrew/homebrew-php
==> Installing dependencies for php56: curl, libpng, freetype, gettext, h
==> Installing php56 dependency: curl
==> Downloading https://homebrew.bintray.com/bottles/curl-7.41.0_1.yosemite.bott
######################################################################## 100.0%
==> Pouring curl-7.41.0_1.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/curl/lib
CPPFLAGS: -I/usr/local/opt/curl/include
==> Summary
�? /usr/local/Cellar/curl/7.41.0_1: 301 files, 2.9M
==> Installing php56 dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.16.yosemite.bott
######################################################################## 100.0%
==> Pouring libpng-1.6.16.yosemite.bottle.tar.gz
�? /usr/local/Cellar/libpng/1.6.16: 17 files, 1.3M
==> Installing php56 dependency: freetype
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.5.5.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring freetype-2.5.5.yosemite.bottle.tar.gz
�? /usr/local/Cellar/freetype/2.5.5: 60 files, 2.6M
==> Installing php56 dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.4.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gettext-0.19.4.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
Mac OS X provides similar software, and installing this software in
parallel can cause all kinds of trouble.
OS X provides the BSD gettext library and some software gets confused if both are in the library path.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/gettext/lib
CPPFLAGS: -I/usr/local/opt/gettext/include
==> Summary
�? /usr/local/Cellar/gettext/0.19.4: 1920 files, 21M
==> Installing php56 dependency: homebrew/dupes/tidy
==> Downloading https://homebrew.bintray.com/bottles-dupes/tidy-20090325.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring tidy-20090325.yosemite.bottle.tar.gz
�? /usr/local/Cellar/tidy/20090325: 10 files, 940K
==> Installing php56 dependency: homebrew/dupes/zlib
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/dupes/zlib-1.2.8.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring zlib-1.2.8.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/zlib/lib
CPPFLAGS: -I/usr/local/opt/zlib/include
==> Summary
�? /usr/local/Cellar/zlib/1.2.8: 9 files, 392K
==> Installing php56 dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-54.1.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring icu4c-54.1.yosemite.bottle.1.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
OS X provides libicucore.dylib (but nothing else).
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/icu4c/lib
CPPFLAGS: -I/usr/local/opt/icu4c/include
==> Summary
�? /usr/local/Cellar/icu4c/54.1: 242 files, 65M
==> Installing php56 dependency: imap-uw
==> Downloading https://homebrew.bintray.com/bottles/imap-uw-2007f.yosemite.bott
######################################################################## 100.0%
==> Pouring imap-uw-2007f.yosemite.bottle.tar.gz
�? /usr/local/Cellar/imap-uw/2007f: 150 files, 9.5M
==> Installing php56 dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.yosemite.bottle.2.t
######################################################################## 100.0%
==> Pouring jpeg-8d.yosemite.bottle.2.tar.gz
�? /usr/local/Cellar/jpeg/8d: 18 files, 776K
==> Installing php56 dependency: unixodbc
==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.2_1.yosemite.b
######################################################################## 100.0%
==> Pouring unixodbc-2.3.2_1.yosemite.bottle.1.tar.gz
�? /usr/local/Cellar/unixodbc/2.3.2_1: 31 files, 1.0M
==> Installing php56
==> Downloading https://www.php.net/get/php-5.6.7.tar.bz2/from/this/mirror
########################### 37.9%
curl: (56) SSLRead() return error -9806
Error: Failed to download resource "php56"
Download failed: https://www.php.net/get/php-5.6.7.tar.bz2/from/this/mirror
localhost:~ zhoujunwen$ brew install php56
==> Installing php56 from homebrew/homebrew-php
==> Downloading https://homebrew.bintray.com/bottles-php/php56-5.6.7.yosemite.bo
######################################################################## 100.0%
==> Pouring php56-5.6.7.yosemite.bottle.tar.gz
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php56/libexec/Apache2/libphp5.so
The php.ini file can be found in:
/usr/local/etc/php/5.6/php.ini
???? PEAR ????
If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
chmod -R ug+w /usr/local/Cellar/php56/5.6.7/lib/php
pear config-set php_ini /usr/local/etc/php/5.6/php.ini system
???? 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.
To have launchd start php56 at login:
ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
Then to load php56 now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
==> Summary
�? /usr/local/Cellar/php56/5.6.7: 500 files, 51M
以上就介紹了mac安裝php56,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。