PHP7 pecl 安装 mongodb扩展

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP7 pecl 安装 mongodb扩展相关的知识,希望对你有一定的参考价值。

Hi,

I‘m running alpine 3.3 in docker with the testing repo for php7 packages, after installing php7-pear, and trying to run pecl I get a bunch of warnings/notices :

~ # pecl
Warning: Invalid argument supplied for foreach() in Command.php on line 249
Warning: Invalid argument supplied for foreach() in /usr/share/php7/PEAR/Command.php on line 249
Notice: Undefined index: honorsbaseinstall in Role.php on line 173
Notice: Undefined index: installable in Role.php on line 139
Notice: Undefined index: phpfile in Role.php on line 204
Notice: Undefined index: config_vars in Role.php on line 46
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 "[email protected]"

ubuntu:
exec $PHP -C -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 "[email protected]"

-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.

sumery: vi /usr/bin/pecl remove -n para

以上是关于PHP7 pecl 安装 mongodb扩展的主要内容,如果未能解决你的问题,请参考以下文章

windows php7 安装 mongodb 扩展

Mac php7安装mongodb扩展以适配使用mongo扩展的php旧版本代码

Mac php7本地安装mongodb扩展以适配使用mongo扩展的线上老代码

php mongodb拓展 安装

php7的扩展库安装方法

Linux下php7的扩展库安装方法