安裝PECL
//php版本 > 7
$ wget http://pear./go-pear.phar
$ php go-pear.phar
//php版本 < 7 $ yum install php-pear //否則會(huì)報(bào)錯(cuò)PHP Parse error: syntax error, unexpected //'new' (T_NEW) in /usr/share/pear/PEAR/Frontend.php on //line 91
安裝擴(kuò)展
$ 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 參數(shù)
安裝完畢后,,添加庫到php.ini
extension=mongodb.so
安裝 PHPLIB
http:///manual/zh/mongodb.tutorial.library.php https:///download/ 安裝完畢后,,安裝 PHP Library for MongoDB (PHPLIB)
$ composer require mongodb/mongodb``<br/>最新版本的命令是:<br/> $ composer.phar require mongodb/mongodb`
一切正確后,,在當(dāng)前目錄下,,生成:vendor目錄,,OK
|