php-driver for mogodb wont't compile

人盡茶涼 提交于 2019-12-11 10:36:36

问题


Centos 6.6 x86_64 kernel version 2.6(something)

I am trying to compile php-driver(downloaded the zip file from git) for mongoDB but it gives error during make all

This is the compile error

/bin/sh /usr/local/mongo-php-driver/libtool --mode=compile cc -I./util -I. -I/usr/local/mongo-php-driver -DPHP_ATOM_INC -I/usr/local/mongo-php-driver/include -I/usr/local/mongo-php-driver/main -I/usr/local/mongo-php-driver -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/mongo-php-driver/api -I/usr/local/mongo-php-driver/util -I/usr/local/mongo-php-driver/exceptions -I/usr/local/mongo-php-driver/gridfs -I/usr/local/mongo-php-driver/types -I/usr/local/mongo-php-driver/batch -I/usr/local/mongo-php-driver/contrib -I/usr/local/mongo-php-driver/mcon -I/usr/local/mongo-php-driver/mcon/contrib -DHAVE_CONFIG_H -g -O2 -c /usr/local/mongo-php-driver/php_mongo.c -o php_mongo.lo mkdir .libs cc -I./util -I. -I/usr/local/mongo-php-driver -DPHP_ATOM_INC -I/usr/local/mongo-php-driver/include -I/usr/local/mongo-php-driver/main -I/usr/local/mongo-php-driver -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/mongo-php-driver/api -I/usr/local/mongo-php-driver/util -I/usr/local/mongo-php-driver/exceptions -I/usr/local/mongo-php-driver/gridfs -I/usr/local/mongo-php-driver/types -I/usr/local/mongo-php-driver/batch -I/usr/local/mongo-php-driver/contrib -I/usr/local/mongo-php-driver/mcon -I/usr/local/mongo-php-driver/mcon/contrib -DHAVE_CONFIG_H -g -O2 -c /usr/local/mongo-php-driver/php_mongo.c -fPIC -DPIC -o .libs/php_mongo.o /usr/local/mongo-php-driver/php_mongo.c:102: warning: initialization discards qualifiers from pointer target type /usr/local/mongo-php-driver/php_mongo.c: In function ‘zm_globals_ctor_mongo’: /usr/local/mongo-php-driver/php_mongo.c:367: error: ‘empty_fcall_info’ undeclared (first use in this function) /usr/local/mongo-php-driver/php_mongo.c:367: error: (Each undeclared identifier is reported only once /usr/local/mongo-php-driver/php_mongo.c:367: error: for each function it appears in.) make: *** [php_mongo.lo] Error 1

I also tried to do "pecl search mongo" but it says

Connection to `ssl://pecl.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?

Thanks in Advance

Regards, Ricky


回答1:


Try to run this command

sudo apt-get install php5-dev php5-cli php-pear

then this

sudo pecl install mongo

Now we just need to enable the module. Edit your php.ini file and add the line. Run this command

gksudo gedit /etc/php5/apache2/php.ini

once the file get opened save this line in the file

extension=mongo.so

For more how to install mongoDB with php try this tutorial

http://w3code.in/2015/10/how-to-install-up-mongodb-and-php-on-ubuntu/




回答2:


if phpVersion >= 7
  use mongodb
else
  use mongo

some links https://docs.mongodb.com/ecosystem/drivers/php/



来源:https://stackoverflow.com/questions/31835100/php-driver-for-mogodb-wontt-compile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!