mogodb的php-driver不会编译

时间:2015-08-05 14:16:17

标签: mongodb mongodb-php

Centos 6.6 x86_64 内核版本2.6(某事)

我正在尝试为mongoDB编译php-driver(从git下载zip文件)但是在make all期间出现错误

这是编译错误

/ 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:警告:初始化从指针目标类型中丢弃限定符 /usr/local/mongo-php-driver/php_mongo.c:在函数'zm_globals_ctor_mongo'中: /usr/local/mongo-php-driver/php_mongo.c:367:错误:'empty_fcall_info'未声明(首次在此函数中使用) /usr/local/mongo-php-driver/php_mongo.c:367:错误:(每个未声明的标识符仅报告一次 /usr/local/mongo-php-driver/php_mongo.c:367:错误:对于它出现的每个函数。) make:*** [php_mongo.lo]错误1

我也尝试过" pecl search mongo"但它说

  
    
      

连接到`ssl://pecl.php.net:443'失败:无法找到套接字传输" ssl" - 你在配置PHP时忘了启用它吗?

    
  

先谢谢

此致 瑞奇

2 个答案:

答案 0 :(得分:1)

尝试运行此命令

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

然后这个

sudo pecl install mongo

现在我们只需要启用该模块。 编辑您的php.ini文件并添加该行。运行此命令

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

文件打开后,将该行保存在文件

extension=mongo.so

有关如何使用php安装mongoDB的更多信息,请尝试本教程

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

答案 1 :(得分:1)

if phpVersion >= 7
  use mongodb
else
  use mongo

一些链接 https://docs.mongodb.com/ecosystem/drivers/php/