您好,登錄后才能下訂單哦!
//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
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。