douye9822 2016-08-21 21:43
浏览 57

PHPize编译Mongo驱动程序的Ubuntu API选项不匹配

I'm running into a problem getting a valid mongo driver compiled for the API version of PHP that I'm running. Using php - v

PHP 5.6.24-1+deb.sury.org~trusty+1 (cli) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

What is happening is that even when I use what I think is the correct phpize it is still configuring the build for an older API version.

When I run /usr/bin/phpize -v here is what I get: Configuring for: PHP Api Version: 20121113 Zend Module Api No: 20121212 Zend Extension Api No: 220121212

BUT when I try to use the compiled version of the mongo driver I get this warning message:

PHP Warning: PHP Startup: mongo: Unable to initialize module Module compiled with module API=20121212 PHP compiled with module API=20131226

Here is the whereis php output:

php: /usr/bin/php /usr/bin/php5.6 /etc/php /usr/lib/php /usr/share/php5.6-mysql /usr/share/php5.6-common /usr/share/php5.6-xml /usr/share/php5.6-curl /usr/share/php5.6-mcrypt /usr/share/php5.6-intl /usr/share/php /usr/share/php5.6-readline /usr/share/php5.6-gd /usr/share/php5.6-opcache /usr/share/php5.6-json /usr/share/php5.6-mbstring /usr/share/man/man1/php.1.gz

Can someone please give me step by step instructions on how to properly compile the Mongo driver on Ubuntu 14.04?

  • 写回答

1条回答 默认 最新

  • dtukyb8095 2016-08-21 21:47
    关注

    I don't know what command you are exactly using, but you should be fine running pecl install on ubuntu.

    So to install this official PHP driver for mongo: https://pecl.php.net/package/mongodb just run:

    pecl install mongodb
    

    and you should be good to go. Maybe it tells you that some libs are missing, but you can use apt-get install to install them afterwards.

    You can read more about the driver here

    If pecl command is not found, install it using

    apt-get install php-pear
    
    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计