7 $ wget http://pear.php.net/go-pear.phar $ php go-pear.phar //php版本 < 7$ yum install php-pear//否則會(huì)報(bào)錯(cuò)PHP Parse error: syn..."/>
您好,登錄后才能下訂單哦!
//php版本 > 7
$ wget http://pear.php.net/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
$ 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
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`
一切正確后,在當(dāng)前目錄下,生成:vendor目錄,OK
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。