鉴于brew突然间的不能使用,简直是好坑的,以前多方便的安装啊,现在却那啥,好尴尬啊
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 安装扩展
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.net/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.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扩展教程就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持我们。