日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

安装 MongoDB PHP 驱动 在CentOS 6.x和遇到的问题

發布時間:2024/9/20 php 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安装 MongoDB PHP 驱动 在CentOS 6.x和遇到的问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

以下安裝mongo-php-driver 也許會遇到

PHP Warning:? PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongodb.so' - /usr/lib64/php/modules/mongodb.so: undefined symbol: bson_decimal128_from_string in Unknown on line 0

問題。

[root@www mongo-php-driver]# git clone https://github.com/mongodb/mongo-php-driver ? ? ? ? ?


Initialized empty Git repository in /home/.../mongo-php-driver/.git/

remote: Counting objects: 9821, done.

remote: Compressing objects: 100% (10/10), done.

remote: Total 9821 (delta 2), reused 0 (delta 0), pack-reused 9811

Receiving objects: 100% (9821/9821), 3.25 MiB | 642 KiB/s, done.


Resolving deltas: 100% (6883/6883), done.


[root@www mongo-php-driver]# cd mongo-php-driver?? ? ? ? ??? ? ? ? ?

[root@www mongo-php-driver]# phpize?? ? ? ? ??? ? ? ? ??? ? ? ? ??? ? ? ? ?


遇到如下問題:

Configuring for:

PHP Api Version: ? ? ? ? 20131106

Zend Module Api No:? ? ? 20131226

Zend Extension Api No: ? 220131226

/usr/bin/m4:config.m4:482: cannot open `src/libmongoc/build/autotools/WeakSymbols.m4': No such file or directory

/usr/bin/m4:config.m4:483: cannot open `src/libmongoc/build/autotools/m4/ax_pthread.m4': No such file or directory

/usr/bin/m4:config.m4:517: cannot open `src/libbson/build/autotools/CheckAtomics.m4': No such file or directory

/usr/bin/m4:config.m4:518: cannot open `src/libbson/build/autotools/FindDependencies.m4': No such file or directory

/usr/bin/m4:config.m4:519: cannot open `src/libbson/build/autotools/m4/ac_compile_check_sizeof.m4': No such file or directory

/usr/bin/m4:config.m4:520: cannot open `src/libbson/build/autotools/m4/ac_create_stdint_h.m4': No such file or directory

/usr/bin/m4:config.m4:565: cannot open `src/libmongoc/build/autotools/Versions.m4': No such file or directory

/usr/bin/m4:config.m4:579: cannot open `src/libbson/build/autotools/Versions.m4': No such file or directory


autom4te: /usr/bin/m4 failed with exit status: 1

解決問題使用如下:

[root@www mongo-php-driver]# git submodule update --init?? ? ? ? ??? ? ? ? ?


參數 init前面是 ‘--’,兩個半角減號,坑死自己了



Submodule 'src/libbson' (https://github.com/mongodb/libbson.git) registered for path 'src/libbson'

Submodule 'src/libmongoc' (https://github.com/mongodb/mongo-c-driver.git) registered for path 'src/libmongoc'

Initialized empty Git repository in /home/.../mongo-php-driver/src/libbson/.git/

remote: Counting objects: 9019, done.

remote: Compressing objects: 100% (4/4), done.

remote: Total 9019 (delta 0), reused 0 (delta 0), pack-reused 9015

Receiving objects: 100% (9019/9019), 6.32 MiB | 60 KiB/s, done.

Resolving deltas: 100% (6258/6258), done.

Submodule path 'src/libbson': checked out '82b3cb4d89fdb590cdda4d2bb591d0062ccc765e'

Initialized empty Git repository in /home/.../mongo-php-driver/src/libmongoc/.git/

remote: Counting objects: 26396, done.

remote: Compressing objects: 100% (147/147), done.

remote: Total 26396 (delta 79), reused 0 (delta 0), pack-reused 26249

Receiving objects: 100% (26396/26396), 14.34 MiB | 2.23 MiB/s, done.

Resolving deltas: 100% (19745/19745), done.


Submodule path 'src/libmongoc': checked out ‘62e680aa26754ef8dbdb2709aac4d2488507872a'


[root@www mongo-php-driver]# phpize?? ? ? ? ??? ? ? ? ?


Configuring for:

PHP Api Version: ? ? ? ? 20131106

Zend Module Api No:? ? ? 20131226

Zend Extension Api No: ? 220131226


[root@www mongo-php-driver]# ./configure?? ? ? ? ??? ? ? ? ?


checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for a sed that does not truncate output... /bin/sed

..........

checking whether to build shared libraries... yes

checking whether to build static libraries... no

configure: creating ./config.status


mongodb was configured with the following options:


Build configuration:

? CFLAGS ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : -g -O2

? Extra CFLAGS ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :? -pthread?

? Developers flags (slow)? ? ? ? ? ? ? ? ? ? ? ? ? :?

? Code Coverage flags (extra slow) ? ? ? ? ? ? ? ? :?

? System mongoc? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : no

? System libbson ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : no

? LDFLAGS? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :?

? EXTRA_LDFLAGS? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? :?

? MONGODB_SHARED_LIBADD? ? ? ? ? ? ? ? ? ? ? ? ? ? :? -lssl -lcrypto -lrt ?


Please submit bugreports at:

? https://jira.mongodb.org/browse/PHPC

config.status: creating ./src/libmongoc/src/mongoc/mongoc-config.h

config.status: creating ./src/libmongoc/src/mongoc/mongoc-version.h

config.status: creating ./src/libbson/src/bson/bson-config.h

config.status: creating ./src/libbson/src/bson/bson-version.h

config.status: creating config.h


config.status: executing libtool commands


[root@www mongo-php-driver]# make?? ? ? ? ??? ? ? ? ?

……

/bin/sh /home/markboo/mongo-php-driver/libtool --mode=install cp ./mongodb.la /home/.../mongo-php-driver/modules

libtool: install: cp ./.libs/mongodb.so /home/.../mongo-php-driver/modules/mongodb.so

libtool: install: cp ./.libs/mongodb.lai /home/.../mongo-php-driver/modules/mongodb.la

libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /home/.../mongo-php-driver/modules

----------------------------------------------------------------------

Libraries have been installed in:

?? /home/.../mongo-php-driver/modules


If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

?? - add LIBDIR to the `LD_LIBRARY_PATH' environment variable

?? ? during execution

?? - add LIBDIR to the `LD_RUN_PATH' environment variable

?? ? during linking

?? - use the `-Wl,-rpath -Wl,LIBDIR' linker flag

?? - have your system administrator add LIBDIR to `/etc/ld.so.conf'


See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------


Build complete.


Don't forget to run 'make test’.


[root@www mongo-php-driver]# make install?? ? ? ? ??? ? ? ? ?

Installing shared extensions: ? ? /usr/lib64/php/modules/

[root@www mongo-php-driver]# echo "extension=mongodb.so" > /etc/php.d/mongo.ini?? ? ? ? ??? ? ? ? ?

[root@www mongo-php-driver]# cat /etc/php.d/mongo.ini??? ? ? ? ??? ? ? ? ?

extension=mongodb.so


apache error_log里出現:

PHP Warning:? PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongodb.so' - /usr/lib64/php/modules/mongodb.so: undefined symbol: bson_decimal128_from_string in Unknown on line 0


這個c-driver的問題,mongo也還沒暫時沒有解決,鏈接如下:https://jira.mongodb.org/browse/CDRIVER-1173

描述如下:

Since bson_decimal128_from_string () requires a null terminated string, the BSON to JSON conversion for bson_decimal128_t allocates a new string+1 since the input isn't null terminated.

We should be able to avoid that extra malloc, either though stack allocation or passing the length to the bson_decimal128_from_string () function.


---------------------------------------------------------------------------------------

所以變更驅動,使用PECL驅動

#?wget https://pecl.php.net/get/mongo-1.6.13.tgz?? ? ? ? ??? ? ? ? ?

#?tar zxvf mongo-1.6.13.tgz?? ? ? ? ??? ? ? ? ?

#?cd mongo-1.6.13?? ? ? ? ??? ? ? ? ?

#?phpize?? ? ? ? ??? ? ? ? ?

#?./configure?? ? ? ? ??? ? ? ? ?

#?make?? ? ? ? ??? ? ? ? ?

#?make install?? ? ? ? ??? ? ? ? ?

#?echo "extension=mongo.so" > /etc/php.d/mongo.ini?? ? ? ? ??? ? ? ? ?


# wget https://pecl.php.net/get/mongodb-1.1.6.tgz?? ? ? ? ??? ? ? ? ?

#?tar -xzf mongodb-1.1.6.tgz?? ? ? ? ??? ? ? ? ?

#?cd mongodb-1.1.6?? ? ? ? ??? ? ? ? ?

#?phpize?? ? ? ? ??? ? ? ? ?

#?./configure?? ? ? ? ??? ? ? ? ?

#?make?? ? ? ? ??? ? ? ? ?

#?make install?? ? ? ? ??? ? ? ? ?

#?echo "extension=mongo.1.1.6.so" > /etc/php.d/mongodb.ini?? ? ? ? ??? ? ? ? ?


# httpd -k restart?? ? ? ? ??? ? ? ? ?


# php -i??? ? ? ? ??? ? ? ? ?

mongo


MongoDB Support => enabled

Version => 1.6.13

Streams Support => enabled

SSL Support => enabled

?? ? ? ? ? ? ? ? ? Supported Authentication Mechanisms? ? ? ? ? ? ? ? ? ?

MONGODB-CR => enabled

SCRAM-SHA-1 => enabled

MONGODB-X509 => enabled

GSSAPI (Kerberos) => disabled

PLAIN => disabled


Directive => Local Value => Master Value

mongo.allow_empty_keys => 0 => 0

mongo.chunk_size => 261120 => 261120

mongo.cmd => $ => $

mongo.default_host => localhost => localhost

mongo.default_port => 27017 => 27017

mongo.is_master_interval => 15 => 15

mongo.long_as_object => 0 => 0

mongo.native_long => 1 => 1

mongo.ping_interval => 5 => 5


mongodb


mongodb support => enabled

mongodb version => 1.1.6

mongodb stability => stable

libmongoc version => 1.3.5

libbson version => 1.3.5


Directive => Local Value => Master Value

mongodb.debug => no value => no value


后一種沒有報錯誤,程序運行也沒有問題!


來源:http://blog.csdn.net/markboo/article/details/51191586

總結

以上是生活随笔為你收集整理的安装 MongoDB PHP 驱动 在CentOS 6.x和遇到的问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。