Reputation: 21236
I have a Symfony 2 application that is using Doctrine MongoDB ODM and I'm trying to get this running with PHP 7.
I have installed PHP 7 successfully but installing dependencies through Composer is giving me grief with the following error:
doctrine/mongodb 1.0.x-dev requires ext-mongo >=1.2.12,<1.7-dev -> the requested PHP extension mongo is missing from your system.
I managed to install the PHP 7 mongo extension through apt:
apt-get install php7.0-mongo
Just to be sure, I have also installed the mongodb
extension through PECL:
sudo apt-get install -y php-pear php7.0-dev libcurl3-openssl-dev
sudo pecl install mongodb
However, I'm still get the error that the mongo extension cannot be found. There seems to be a version discrepancy in that ext-mongo >=1.2.12
is required but only 1.1.6
was installed::
$ php -i | grep mongo
/etc/php/7.0/cli/conf.d/20-mongodb.ini,
mongodb
mongodb support => enabled
mongodb version => 1.1.6
mongodb stability => stable
libmongoc version => 1.3.5
mongodb.debug => no value => no value
What is the correct way to install the mongo extension required by Doctrine ODM for PHP 7?
Upvotes: 6
Views: 8698
Reputation: 306
In order to use Symfony with MongoDB you need:
You can follow the instructions here: "How to install Symfony3 with MongoDB"
It was written for Symfony3 but for Symfony2 is the same issue. The problem was PHP7 + mongodb driver + Doctrine.
Upvotes: -3
Reputation: 1926
in composer.json I added
"provide" : {
"ext-mongo": "*"
},
before "require" and this forces to install latest extension
Upvotes: 11
Reputation: 5542
On PHP7 you cannot install mongo
extension. What you can do, is to install https://github.com/alcaeus/mongo-php-adapter first, then install doctrine.
composer require alcaeus/mongo-php-adapter
Upvotes: 17