报错:
/usr/local/mongo-1.4.0/mongoclient.h:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘php_mongoclient_new’ @
/usr/local/mongo-1.4.0/mongoclient.h:29: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
In file included from /usr/local/mongo-1.4.0/php_mongo.c:26:
/usr/local/mongo-1.4.0/cursor.h:118: error: expected declaration specifiers or ‘...’ before ‘zend_rsrc_list_entry’
/usr/local/mongo-1.4.0/cursor.h:121: error: expected ‘)’ before ‘*’ token
In file included from /usr/local/mongo-1.4.0/php_mongo.c:36:
/usr/local/mongo-1.4.0/types/id.h:19: error: expected declaration specifiers or ‘...’ before ‘zend_uint’
/usr/local/mongo-1.4.0/types/id.h:20: error: expected declaration specifiers or ‘...’ before ‘zend_uint’
/usr/local/mongo-1.4.0/php_mongo.c: In function ‘OnUpdatePingInterval’:
/usr/local/mongo-1.4.0/php_mongo.c:110: error: ‘new_value_length’ undeclared (first use in this function)
/usr/local/mongo-1.4.0/php_mongo.c:110: error: (Each undeclared identifier is reported only once
/usr/local/mongo-1.4.0/php_mongo.c:110: error: for each function it appears in.)
/usr/local/mongo-1.4.0/php_mongo.c:110: warning: passing argument 1 of ‘is_numeric_string’ from incompatible pointer type
/usr/local/php7/include/php/Zend/zend_operators.h:148: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/usr/local/mongo-1.4.0/php_mongo.c: In function ‘OnUpdateIsMasterInterval’:
/usr/local/mongo-1.4.0/php_mongo.c:122: error: ‘new_value_length’ undeclared (first use in this function)
/usr/local/mongo-1.4.0/php_mongo.c:122: warning: passing argument 1 of ‘is_numeric_string’ from incompatible pointer type
/usr/local/php7/include/php/Zend/zend_operators.h:148: note: expected ‘const char *’ but argument is of type ‘struct zend_string *’
/usr/local/mongo-1.4.0/php_mongo.c: In function ‘zm_startup_mongo’:
/usr/local/mongo-1.4.0/php_mongo.c:153: error: ‘php_mongo_cursor_list_pfree’ undeclared (first use in this function)
/usr/local/mongo-1.4.0/php_mongo.c:372:57: error: macro "zend_hash_get_current_data" passed 2 arguments, but takes just 1
/usr/local/mongo-1.4.0/php_mongo.c: In function ‘get_tagset_from_array’:
/usr/local/mongo-1.4.0/php_mongo.c:372: error: ‘zend_hash_get_current_data’ undeclared (first use in this function)
/usr/local/mongo-1.4.0/php_mongo.c:381: warning: passing argument 2 of ‘zend_hash_get_current_key_ex’ from incompatible pointer type
/usr/local/php7/include/php/Zend/zend_hash.h:195: note: expected ‘struct zend_string **’ but argument is of type ‘char **’
/usr/local/mongo-1.4.0/php_mongo.c:381: warning: passing argument 3 of ‘zend_hash_get_current_key_ex’ from incompatible pointer type
/usr/local/php7/include/php/Zend/zend_hash.h:195: note: expected ‘zend_ulong *’ but argument is of type ‘uint *’
/usr/local/mongo-1.4.0/php_mongo.c:381: warning: passing argument 4 of ‘zend_hash_get_current_key_ex’ from incompatible pointer type
/usr/local/php7/include/php/Zend/zend_hash.h:195: note: expected ‘HashPosition *’ but argument is of type ‘ulong *’
/usr/local/mongo-1.4.0/php_mongo.c:381: error: too many arguments to function ‘zend_hash_get_current_key_ex’
/usr/local/mongo-1.4.0/php_mongo.c:387: warning: passing argument 3 of ‘mongo_read_preference_add_tag’ makes pointer from integer without a cast
/usr/local/mongo-1.4.0/mcon/read_preference.h:50: note: expected ‘char *’ but argument is of type ‘int’
/usr/local/mongo-1.4.0/php_mongo.c:429:47: error: macro "add_assoc_string" passed 4 arguments, but takes just 3
/usr/local/mongo-1.4.0/php_mongo.c: In function ‘php_mongo_make_tagsets’:
/usr/local/mongo-1.4.0/php_mongo.c:429: error: ‘add_assoc_string’ undeclared (first use in this function)
/usr/local/mongo-1.4.0/php_mongo.c:463:61: error: macro "zend_hash_get_current_data" passed 2 arguments, but takes just 1
/usr/local/mongo-1.4.0/php_mongo.c: In function ‘php_mongo_use_tagsets’:
/usr/local/mongo-1.4.0/php_mongo.c:463: error: ‘zend_hash_get_current_data’ undeclared (first use in this function)
make: *** [php_mongo.lo] Error 1
解决方案:
curl -O https://pecl.php.net/get/mongodb-1.2.3.tgz
tar zxf mongodb-1.2.3.tgz
cd mongodb-1.2.3
phpize
./configure --with-php-config=php-config
make&&make install