0
votes

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

1 Answers

0
votes

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