欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

mac pecl 安装php7.1扩展教程

程序员文章站 2023-11-17 21:45:16
鉴于brew突然间的不能使用,简直是好坑的,以前多方便的安装啊,现在却那啥,好尴尬啊 brew search php ==> searching local taps...

鉴于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

修改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扩展教程就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。