安装PECL

//php版本 > 7

$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar

//php版本 < 7
$ yum install php-pear
//否则会报错PHP Parse error: syntax error, unexpected //'new' (T_NEW) in /usr/share/pear/PEAR/Frontend.php on //line 91

安装扩展

$ pecl install mongodb

And if I try to install mongodb for example, I'll get the same warnings as before with an extra "XML Extension not found" at the end.

I compared the "/usr/bin/pecl" with one from ubuntu and the only difference is the "-n" in the exec line :
alpine:
exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@"

-n meaning: "No configuration (ini) files will be used"
If not using conf, xml won't be loaded, so I'm pretty sure the "-n" should be removed.

I tested after removing it, and got no warning or anything and was able to install my extension.

以上问题的解决方式:
vi /usr/bin/pecl
remove -n para
删除 -n 参数

安装完毕后,添加库到php.ini


extension=mongodb.so

安装 PHPLIB

http://php.net/manual/zh/mongodb.tutorial.library.php
https://getcomposer.org/download/
安装完毕后,安装 PHP Library for MongoDB (PHPLIB)
$ composer require mongodb/mongodb``<br/>最新版本的命令是:<br/>$ composer.phar require mongodb/mongodb`

一切正确后,在当前目录下,生成:vendor目录,OK

PHP7 pecl 安装 mongodb扩展 和 PHPLIB相关推荐

  1. php7.1解压包安装,【Swoole】php7.1安装swoole扩展

    参照:https://zixuephp.net/article-430.html 1.源码编译安装,PHP版本7.1.33 2.在已经编译好安装的php7.1中安装swoole扩展. 一.下载swoo ...

  2. PHP7.1安装yaf扩展

    PHP71安装yaf扩展 把PHP命令加到系统 下载Yaf扩展包 安装 PHP7.1安装yaf扩展 把PHP命令加到系统 我的PHP安装目录是/usr/local/webserver/php,所以ph ...

  3. centos php支持yaf,CentOS环境下给PHP7.0安装yaf扩展

    | CentOS环境下给PHP7.0安装yaf扩展 在CentOS环境下给PHP7.0安装yaf扩展,首先要知道PHP的安装目录在哪里,以我当前的路径为例,在/usr/local/php目录下. 下一 ...

  4. php7.2 安装phpredis扩展,以及phpredis操作redis命令列表

    phpredis是redis的php的一个扩展,效率是相当高有链表排序功能,对创建内存级的模块业务关系;以下是redis官方提供的命令使用技巧: 下载安装地址如下: PHP7.2 安装Redis扩展 ...

  5. php7 libevent扩展,php7下安装event扩展方法

    有效安排I/O,时间和信号的扩展 使用可用于特定平台的最佳I/O通知机制的事件,是PHP基础设施的libevent端口. 下载地址:http://pecl.php.net/package/event ...

  6. php 7.1 openssl安装,介绍 php7.1 安装openssl扩展,php openssl

    介绍 php7.1 安装openssl扩展介绍php7.1安装心脏出血扩展,PHP7栏目介绍php7.1 安装openssl扩展的方法 推荐(免费):PHP7 在安装(同脉冲亮度分析仪)脉冲振幅分析器 ...

  7. 7.1 pdo 宝塔面板php_CentOS 7.6下宝塔面板 PHP7.2安装sqlsrv扩展

    PHP需要的相关环境 (慎用 yum update)yum update yum install php php-pdo php-xml php-pear php-devel re2c gcc-c++ ...

  8. php7.1安装mysqli扩展,centos php7 安装mysqli扩展心得

    在新配服务器时发现,php无法连接到mysql.通过phpinfo发现.根本没有显示mysqli的相关配置.经过一系列研究.总结了下.: 第一步: 在phpinfo里没有mysqli配置,原因是安装p ...

  9. Mac上通过pecl安装PHP扩展

    注意 1. 如果pecl收录了你需要的扩展,例如mbstring,即可通过以下方法来安装扩展: sudo pecl search mbstring sudo pecl install mbstring ...

最新文章

  1. linux screen 常用命令
  2. Camera框架初探
  3. 【Groovy】MOP 元对象协议与元编程 ( 方法注入 | 使用 @Mixin 注解进行方法注入 | Mixin 混合多个类优先级分析 )
  4. CABasicAnimation使用总结
  5. python制作图片数据集_Pytorch自己加载单通道图片用作数据集训练的实例
  6. MySQL /“N叉树”的N值在MySQL中是可以被人工调整吗
  7. 代码+实例:深度学习中的“轴”全解
  8. VMware12提示 已将该虚拟机配置为使用 64 位客户机操作系统。但是,无法执行 64 位操作...
  9. 100万并发连接服务器笔记之1M并发连接目标达成
  10. python manager模块_Python 并发模块
  11. Google Chrome,另类的邪恶垄断?
  12. 全触摸模式,让你尽享ipad 开发出的精品
  13. Java核心编程总结(九、File文件类),王道训练营Java百度云盘
  14. mac怎么给移动硬盘分区
  15. 苹果吃鸡蓝牙耳机推荐哪个?性价比高的游戏蓝牙耳机推荐
  16. qt MD5 和AES 加密
  17. 血型(输血-受血)匹配数电设计
  18. 5秒解决:VMware Workstation 与 Hyper-V 不兼容。请先从系统中移除 Hyper-V 角色,然后再运行 VMware Workstation。
  19. 专业能力一般的应届本科生,该如何准备面试
  20. cad计算机面积和周长,CAD怎么计算二维图形的面积和周长

热门文章

  1. win下 git gui 使用教程
  2. Sublime Text 3已卸载
  3. Python 2.5.7 高阶函数
  4. CI如何接受POST请求中的JSON数据
  5. Nginx 部署 Django
  6. 浏览器与WEB服务器交互
  7. node生成uuid
  8. 【LeetCode】231. Power of Two
  9. 发布水晶报表时需要在服务器进行如下操作
  10. github可视化工具_Github标星2.6K!微软开源的可视化工具,未免太酷炫了吧