PECL(The PHP Extension Community Library)是 PHP 擴展的存儲庫,爲 PHP 全部的擴展提供提供託管和下載服務。php
經過 PEAR(PHP Extension and Application Repository)的 Package Manager 的安裝管理方式,能夠對 PECL 擴展進行下載和安裝。curl
官方提供了 PEAR 在各個平臺的安裝方式,直接看官方文檔的請進【傳送門】,macOS 平臺官方安裝翻譯以下。url
使用 curl 命令下載便可spa
curl -O https://pear.php.net/go-pear.phar
使用 sudo 受權進行安裝:.net
sudo php -d detect_unicode=0 go-pear.phar
安裝過程須要進行簡單的配置,以下:翻譯
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /usr 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/bin 5. PHP code directory ($php_dir) : /usr/share/pear 6. Documentation directory : /usr/docs 7. Data directory : /usr/data 8. User-modifiable configuration files directory : /usr/cfg 9. Public Web Files directory : /usr/www 10. System manual pages directory : /usr/man 11. Tests directory : /usr/tests 12. Name of configuration file : /private/etc/pear.conf 1-12, 'all' or Enter to continue: 1
輸入 1,將安裝根目錄修改成 /usr/local/pear;
輸入 4,將命令安裝到 /usr/local/bin 目錄;
其它選項默認便可,一路回車。code
出現以下結果,則安裝成功blog
$ pear version PEAR Version: 1.10.5 PHP Version: 7.1.7 Zend Engine Version: 3.1.0
PECL 官方地址:http://pecl.php.net/
PEAR 官方地址:http://pear.php.net/unicode