0

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

Ricky
  • 9
  • 2

2 Answers2

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/

Ricky
  • 566
  • 3
  • 12
1
if phpVersion >= 7
  use mongodb
else
  use mongo

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

puz_zle
  • 459
  • 5
  • 7