Switch the php version from brew to macbrew and from macbrew to php.
The first step is to install brew Brew, which is a package management tool under Mac. You can install the development tool conveniently by hosting Mac-compatible compilation configurations and patches through Github. Mac comes with ruby, which makes it easy to install. It also automatically installs git for you. Official Website: http://brew.sh in mac terminal directly input command line: ruby-e "$ (curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" after installation is complete, it is recommended to perform a self-check: brew doctor if you see Your system is ready to brew. then your brew can be used. Common commands: (all software uses PHP5.5 as an example) brew update # update the brew installation package. We recommend that you execute this command each time.
Brew search php55 # search for php5.5
Brew tap maid/php # installation extension <gihhub_user/repo>
Brew tap # view the list of installed extensions
Brew install php55 # install php5.5
Brew remove php55 # uninstall php5.5
Brew upgrade php55 # upgrade php5.5
Brew options php55 # view php5.5 Installation options
Brew info php55 # view php5.5 related information
Brew home php55 # Visit the official php5.5 website
Brew services list # view services installed by the system through brew
Brew services cleanup # Clear useless STARTUP configuration files that have been uninstalled
Brew services restart php55 # restart php-fpm Step 2 to install PHP
Add brew's PHP extension Library: brew update
Brew tap homebrew/dupes
Brew tap homebrew/php
You can run the brew options php53 command to view the options for installing php5.3 in brew tap Joseph/homebrew-php. Here I use the following options to install php5.3: brew install php53 -- with-apache -- with-gmp -- with-imap -- with-tidy -- with-debug switch PHP version:
brew install php-[version]
[Version] = 56 | 70
Brew unlink PHP-Previous Version
Brew link php-current version
The corresponding configurations are in/usr/local/etc/php /.
Manage PHP extensions:
First: brew tap homebrew/php
View related extensions: brew search
Installation Extension: brew install php-[version]-extension name
Such as: brew install php56-Redis
Uninstall expansion: brew uninstall php-[version]-expansion name
Delete the corresponding configuration file:rm -rf /usr/local/etc/php/5.6/conf.d/ext-imagick.ini
Note: To install multi-Thread extensions such as pthreads, because such extensions depend on php zts version (Zend Thread Safety), brew is installed with Thread Safety by default ), this may cause conflicts between the extension and PHP versions. In this case, you can only re-traverse the source code, that is, add--build-from-source
For examplebrew install --build-from-source php56-redis