鑒于brew突然間的不能使用,簡直是好坑的,以前多方便的安裝啊,現(xiàn)在卻那啥,好尷尬啊
brew search php
==> Searching local taps...
php@5.6 ✔ php@7.1 ✔ brew-php-switcher php php-code-sniffer php-cs-fixer php@7.0 phplint phpunit
==> Searching taps on GitHub...
homebrew/cask/eclipse-php homebrew/cask/netbeans-php
==> Searching blacklisted, migrated and deleted formulae...
brew install php@7.1
php -v
PHP 7.1.18 (cli) (built: May 25 2018 19:18:42) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.18, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
pecl安裝
curl -O http://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
一路回車到最后,然后
pecl version
pecl 安裝擴(kuò)展
pecl search mongodb 前面直接安裝就行,然后我下面展示最后顯示的內(nèi)容
Build process completed successfully
Installing '/usr/local/Cellar/php@7.1/7.1.18/pecl/20160303/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.4.4
Extension mongodb enabled in php.ini
這個(gè)時(shí)候我的php.ini 是軟連接到的etc下面,然后上面安裝的擴(kuò)展會(huì)自動(dòng)安裝到php.ini中,然后我們把里面加載的刪除掉
# xdebug.so編譯到了 /usr/local/Cellar/php@7.1/7.1.18/lib/php/20160303/ 目錄下
$ cd /usr/local/Cellar/php@7.1/7.1.18/ ll
# 將mongodb.so移動(dòng)到php@7.1默認(rèn)擴(kuò)展目錄
cp /usr/local/Cellar/php@7.1/7.1.18/pecl/20160303/mongodb.so /usr/local/Cellar/php@7.1/7.1.18/lib/php/20160303
php –ini 查看
Configuration File (php.ini) Path: /usr/local/etc/php/7.1
Loaded Configuration File: /usr/local/etc/php/7.1/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.1/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.1/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.1/conf.d/mongodb.ini,
/usr/local/etc/php/7.1/conf.d/redis.ini,
/usr/local/etc/php/7.1/conf.d/xdebug.ini
修改php.ini的配置
刪除上面加入的
extension="mongodb.so"
# 在`/usr/local/etc/php/7.1/conf.d`目錄下新增mongodb.ini
$ vim /usr/local/etc/php/7.1/conf.d/mongodb.ini
# 加入以下內(nèi)容
[mongodb]
extension="mongodb.so"
查看擴(kuò)展
其他的擴(kuò)展也是這樣安裝,很簡單,大家參考
以上這篇mac pecl 安裝php7.1擴(kuò)展教程就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
您可能感興趣的文章:- docker 安裝 php-fpm 服務(wù) / 擴(kuò)展 / 配置的示例教程詳解
- Ubuntu18.04系統(tǒng)安裝、配置Redis及phpredis擴(kuò)展操作詳解
- linux下php安裝xml擴(kuò)展的詳細(xì)步驟
- 解決php擴(kuò)展安裝不生效問題
- Mac下關(guān)于PHP環(huán)境和擴(kuò)展的安裝詳解
- Linux下安裝PHP curl擴(kuò)展的方法詳解
- CentOS7安裝PHP7 Redis擴(kuò)展的方法步驟
- PHP安裝memcache擴(kuò)展的步驟講解
- PHP安裝BCMath擴(kuò)展的方法
- PHP擴(kuò)展安裝方法步驟解析