One, previous Mac installation php and PHP extension Way
Children's shoes with Mac know that we used to install PHP with brew install Php70,brew install PHP71, with brew install Php70-xdebug,brew install Php71-redis and so on to install a version of PHP corresponding extension, and this installation is very convenient, each extension uses a single configuration file, placed in the/USR/LOCAL/ETC/PHP/7.1/CONF.D Inside (where 7.1 is the version, there may be other versions on your computer), as shown below:
Bruce > ... > php > 7.1 > CONF.D > Ls-l
-rw-r--r-- 1 Bruce admin 2 Ext-igbinary.ini
-rw-r--r-- 1 Bruce admin 4 Ext-imagick.ini
-rw-r--r-- 1 Bruce admin 4132 Dec 2 Ext-memcached.ini
-rw-r--r-- 1 Bruce admin Apr 8 10:45 Ext-opcache.ini
-rw-r--r-- 1 Bruce admin 292 Dec 2 Ext-redis.ini
-rw-r--r-- 1 Bruce admin 273 Apr 20:48 Ext-xdebug.ini
second, third-party maintained PHP Tap was moved to Homebrew/core
Look, with brew search php71 is prompted, I used this tap:josegonzalez/php was moved to Homebrew/core
Bruce > ~ > Brew Search php71
If you meant "php71" specifically:
It is migrated from josegonzalez/php to Homebrew/core.
The reason for the move: homebrew in the 1.5 update shows that the tap will be deprecated and archived by 2018-03-31, because the homebrew organization has been unable to pass the non-core formula tap way, To maintain a consistent experience that can be accepted by users or contributors, and the amount of continuous integrity!
What the heck? I read the translation of a half-day also feel not fluent ah, but the general meaning I know, I read the original:
By 31st March 2018 we'll deprecate and archive the homebrew/php tap. Unfortunately we have been unable to maintain an acceptable, consistent user or contributor experience and CI workload thr Ough Non-core formula taps in the Homebrew organisation so we is continuing to migrate widely used formulae into Homebrew /core and encourage more niche formulae and options to being supported outside the Homebrew organisation. Https://brew.sh/2018/04/09/homebrew-1.6.0/We deprecated and archived the homebrew/php tap and created new PHP and Versione d [email protected]* formulae in homebrew/core. This completes the deprecation and archival of the last Non-homebrew/core tap for end-users. We encourage more niche formulae and options to being supported in taps outside the Homebrew organisation. CI workload ci What does that mean? Please see: https://www.netapp.com/us/info/what-is-continuous-integration-continuous-delivery-cicd.aspx
third, now how to install PHP and PHP extension?
1) How to install PHP extensions
First I want to say how to install the extension, because I found this problem is because I installed the AMQP extension, with brew search AMQP, unable to query a similar php71-amqp such an extension, so go online search, found that many people say that now can not be installed in the brew of the expansion of the way , to usepecl Install AMQPSuch a way to install, so go to find out why can not use brew way to install the extension, found the result is the 2nd mentioned above reasons, so I decided to use PECL to install AMQP extension, but I never used pecl, do not know what is, checked the discovery pecl is "PHP Extension Community Library ", translation is PHP extension library, see Pecl install AMQP think pecl must be an order, I do not have on the computer on a bai, so I would like to install a pecl, I first use brew to find out if there is no pecl:brew search pecl, the results of the query to No, and out a bunch of information like an error message (serious look at the fact is not an error), I would like to brew how can not install it, do you want to use the source package? So go online check, on https://pecl.php.net/found the packaging and distribution system used by PECL are shared with its sister, PEAR. Why the sister? Not brother? In doubt ... Then I double 叒 Corporation to check pear is what things, I think should not be I like to eat Sydney, a check is not Sydney, but "PHP Extension and application Repository" translation is PHP extension and application library, Now know Pear is pecl sister, but I want to install is pecl Ah, in the end how to install??? On the internet for half a day, like this brother did not find how to install pecl:https://segmentfault.com/q/1010000006735505?_ea=1113143 I want to install the swoole extension in my system, The official website is provided by the PECL way to install, but I input pecl install swoole after the system said did not find the command, and then I Baidu has not found how to install pecl this thing in Linux, what is this is a what east, how to install him? In fact, I now know, to use the PECL command, as long as the installation of pear on the line, but a half-day, and no one said that the installation of pear can use the pecl command, later saw a lot of answers are mentioned pear, I will be ready to install a pear, so brew search pear, rely on, No, I checked pear results come out a "what is B AH (Shakespeare)":
Bruce > ~ > Brew Search Pear
I think, do you want to use the source package installation? Check AH check, Degree Niang asked Goojje, finally found that this is installed:
Because I am a Mac, so search in https://pear.php.net/manual/en/installation.getting.php: Mac
php-d detect_unicode=0 Go-pear.phar
Is the first download, then use PHP installation, the installation process I did not write down, anyway, should be no difficulty! Finally, the pear is finally installed so that you can use PECL.
I just want to install an AMQP extension, the results of a half-day, and now finally installed, come on, began to install AMQP expansion: pecl install AMQP, wipe, error ... I can not remember what is wrong, anyway is unable to install, I do not know how to solve!
Finally I try to
: Brew install PHP, after installation, then use PECL install Amqp,bingo, success! Brew Services Restart PHP Restart a php-fpm to find this extension in Phpinfo! But I looked at php.ini, and found that really like online a foreigner said, It's very stupid that the pecl put the extension reference to the top of the php.ini, which means PECL installation After the extension of PHP, it is true that it will automatically live php.ini add a line to enable the extension of the statement, that is extension= Xxxx.so this, but this is too silly B, unexpectedly added directly to the top of php.ini, because we all know that this statement should be put into the php.ini in this area:
; Dynamic Extensions;
It doesn't affect the operation, but it always feels weird! But I still do not go to move it, because all plug-ins are so loaded, each move a bit too much trouble, anyway this can also use!
That is, if you want to install the extension using PECL, you need to reinstall the latest version of PHP, direct Brew install PHP can be, previously with the brew install php71,brew install [email protected] this way installed, can also be installed with the Brew install PHP again, will not overwrite the original version, but it seems to be prompted to overwrite what things, I installed the time did not record, we do it according to the instructions.
In short, now the MAC installation of PHP extension can not be used brew, to find a pecl installed
1, you need to use the Brew install PHP reinstall PHP (rest assured, will not overwrite the previous version) 2, you need to install pear (installed pear can use pecl install xdebug this way installed PHP extension) If there are errors please point out!
How to install PHP extensions after Mac homebrew-1.5