macpecl安装php7.1扩展教程
鉴于brew突然间的不能使⽤,简直是好坑的,以前多⽅便的安装啊,现在却那啥,好尴尬啊
brew search php
==> Searching
php@5.6 ✔      php@7.1 ✔      brew-php-switcher  php          php-code-sniffer  php-cs-fixer    php@7.0        phplint        phpunit
==> Searching taps
homebrew/cask/eclipse-php                                      homebrew/cask/netbeans-php
==> Searching blacklisted, migrated and
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 pear.php/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
⼀路回车到最后,然后
pecl version
pecl 安装扩展
pecl search mongodb 前⾯直接安装就⾏,然后我下⾯展⽰最后显⽰的内容
Build process completed successfully
Installing '/usr/local/Cellar/php@7.1/7.1.18/pecl/20160303/mongodb.so'
install ok: channel://pecl.php/mongodb-1.4.4
Extension mongodb enabled in php.ini
这个时候我的php.ini 是软连接到的etc下⾯,然后上⾯安装的扩展会⾃动安装到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移动到php@7.1默认扩展⽬录
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.iniphp8兼容php7吗
修改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
# 加⼊以下内容
[mongodb]
extension="mongodb.so"
查看扩展
php -m
其他的扩展也是这样安装,很简单,⼤家参考
以上这篇mac pecl 安装php7.1扩展教程就是⼩编分享给⼤家的全部内容了,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。