In recent years has been in the LNMP environment for development, which PHP or 5.5 version, a bit old, last December PHP7 has been officially released, added some syntax features, the biggest bright spot is the performance of the promotion, so always want to upgrade to the PHP7, due to the time relationship has been dragged to the present. The latest version of PHP to write this article is: 7.0.9 stable, so the stability of the basic need not worry.
Previously written Mac install LNMP environment is installed with brew, this upgrade PHP7 continue to use brew, install/upgrade software is very convenient.
Upgrading brew
Brew Update
Configuration
Brew Tap Homebrew/dupes
Brew Tap Homebrew/versions
Brew Tap homebrew/homebrew-php
Install PHP7
Brew Install PHP70
Problems encountered
Installation tips:
➜~ Brew Install Php70
==> installing PHP70 from homebrew/php
Error:cannot install HOMEBREW/PHP/PHP70 because conflicting formulae.
Php55:because different PHP versions install the same binaries.
Please ' Brew unlink php55 ' before continuing.
Unlinking removes a formula ' s symlinks from/usr/local. You can
Link the formula again after the install finishes. Can--force this
Install, but the build may fail or cause obscure side-effects in the
Resulting software.
Follow the prompts: Brew unlink Php55
Continue Setup: Brew Install PHP70
Configuration file
The configuration files that have been installed are all in the/usr/local/etc/php/7.0 directory, respectively, as follows:
Php.ini/usr/local/etc/php/7.0/php.ini
Php-fpm.conf/usr/local/etc/php/7.0/php-fpm.conf
PHP, Phpize, Php-config Ls/usr/local/opt/php70/bin
php-fpm/usr/local/opt/php70/sbin/php-fpm
Join power-on Boot
Mkdir-p ~/library/launchagents
Ln-sfv/usr/local/opt/php70/homebrew.mxcl.php70.plist ~/library/launchagents/
Launchctl load-w ~/library/launchagents/homebrew.mxcl.php70.plist
Command-line configuration
Vim ~/.ZSHRC
Will
Export Path= "$ (Brew--prefix php55)/bin: $PATH"
Replaced by
Export Path= "$ (Brew--prefix homebrew/php/php70)/bin: $PATH"
Alias php-fpm.start= "Launchctl load-w ~/library/launchagents/homebrew.mxcl.php55.plist"
Alias php-fpm.stop= "Launchctl unload-w ~/library/launchagents/homebrew.mxcl.php5.plist"
Alias php-fpm.restart= ' php-fpm.stop && php-fpm.start '
Amended to
Alias php-fpm.start= "Launchctl load-w ~/library/launchagents/homebrew.mxcl.php70.plist"
Alias php-fpm.stop= "Launchctl unload-w ~/library/launchagents/homebrew.mxcl.php70.plist"
Alias php-fpm.restart= ' php-fpm.stop && php-fpm.start '
Reload configuration file
SOURCE ~/.ZSHRC
Verify version
PHP version
➜~/usr/local/opt/php70/bin/php-v
PHP 7.0.9 (CLI) (Built:jul 2016 14:50:47) (NTS)
Copyright (c) 1997-2016 the PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
PHP-FPM version
➜~/usr/local/opt/php70/sbin/php-fpm-v
PHP 7.0.9 (fpm-fcgi) (Built:jul 21 2016 14:50:51)
Copyright (c) 1997-2016 the PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
Start PHP-FPM
Executive: Php-fpm.start
Check for successful startup:
➜~ PS Aux|grep php-fpm
Qloog 60380 0.2 0.0 2432792 604 s001 r+ 6:00pm 0:00.00 grep--color=auto--exclude-dir=.bzr--exclu De-dir=cvs--exclude-dir=.git--exclude-dir=.hg--exclude-dir=.svn php-fpm
Qloog 60378 0.0 0.0 2473348 620?? S 6:00pm 0:00.00/usr/local/opt/php70/sbin/php-fpm--fpm-config/usr/local/etc/php/7.0/php-fpm.conf
Qloog 60377 0.0 0.0 2473348 648?? S 6:00pm 0:00.00/usr/local/opt/php70/sbin/php-fpm--fpm-config/usr/local/etc/php/7.0/php-fpm.conf
Qloog 60372 0.0 0.0 2475396 7844?? S 6:00pm 0:00.03/usr/local/opt/php70/sbin/php-fpm--fpm-config/usr/local/etc/php/7.0/php-fpm.conf
Install extension
Yaf
Brew Install Php70-yaf
Configuration file
/usr/local/etc/php/7.0/conf.d/ext-yaf.ini
Memcached
Brew Install php70-memcached
Configuration file
/usr/local/etc/php/7.0/conf.d/ext-memcached.ini
Redis
Brew Install Php70-redis
Configuration file
/usr/local/etc/php/7.0/conf.d/ext-redis.ini
Xdebug
Brew Install Php70-xdebug
Configuration file
/usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
Swoole
Brew Install Php70-swoole
Configuration file
/usr/local/etc/php/7.0/conf.d/ext-swoole.ini
More Extensions perform brew install extensions for installation