The following installation Mongo-php-driver may encounter
PHP warning:php startup:unable to load Dynamic Library '/usr/lib64/php/modules/mongodb.so '-/usr/lib64/php/modules/mon godb.so:undefined symbol:bson_decimal128_from_string in Unknown on line 0
Problem.
[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
Encountered the following problems:
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
Solve the problem using the following:
[Root@www mongo-php-driver]# git submodule update--init
Parameter init is preceded by '--', two half-width minus, pit dead
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 | 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), 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, handles long lines and-e .../bin/grep
Checking for egrep .../bin/grep-e
Checking for a sed this 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 is 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 are ever happen to want to link against installed libraries
In a given directory, Libdir, your 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 '
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 appears:
PHP warning:php startup:unable to load Dynamic Library '/usr/lib64/php/modules/mongodb.so '-/usr/lib64/php/modules/mon godb.so:undefined symbol:bson_decimal128_from_string in Unknown on line 0
This c-driver problem, MONGO also haven't solved temporarily, link is as follows: https://jira.mongodb.org/browse/CDRIVER-1173
The description is as follows:
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 are able to avoid this extra malloc, either though stack allocation or passing the length to the bson_decimal128_ From_string () function.
---------------------------------------------------------------------------------------
So change drive, use PECL drive
# 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
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
The latter one does not report an error, and the program runs without problems.