Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update PHP Mongo Extension to 1.5 on Ubuntu 14

PHP and Mongo are working correctly however the php5-mongo extension needs updating.

Currently it is version 1.4.5, version 1.5.x is required to be compatible with the latest https://github.com/doctrine/mongodb/

Running does not update the version.

sudo apt-get install php5-mongo

Additional info

  • mongod --version db version v2.6.12
  • php --version PHP 5.5.9-1ubuntu4.14

How can the extension be updated? Is pecl required to perform the update?

like image 848
lookbadgers Avatar asked Apr 21 '16 08:04

lookbadgers


1 Answers

Try with PECL

sudo pecl install mongodb

Sometime you may get SSL error when connecting to the mongodb so please install dependencies before the pecl installation

sudo pecl channel-update pecl.php.net
sudo pecl uninstall mongodb
sudo apt-get install libcurl4-openssl-dev pkg-config libssl-dev
sudo pecl install mongodb

You should add "extension=mongodb.so" to php.ini

Verify the MongoDB extension and module by using

sudo php --ri mongodb | grep version
sudo apt-cache policy php-mongodb
like image 98
AeonM Avatar answered Oct 20 '22 00:10

AeonM