简体   繁体   中英

ZF2, doctrine-mongodb and PHP7

I update a simple skeleton project ZF2 to PHP7 and I install the libraries for mongodb in php7

sudo pecl install mongodb

And I add in cli php.in the line

extension=mongodb.so

I do a phpinfo and the extension of mongodb is 1.1.3-dev.

I try to install:

  • "doctrine/doctrine-mongo-odm-module": "dev-master"
  • "doctrine/mongodb-odm": "dev-master"

But I have an error.

doctrine/mongodb 1.2.1 requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.....

The question is doctrine-mongodb is compatible with php7 and the php driver mongodb-1.1?

Not yet. Thay are working on this issue. You can find information about progress, or some methods to run doctrine-odm on php 7 in this thread

Here my composer.json and I get it to work. The "provide" is the more important here:

"provide" : {
"ext-mongo": "*"
  },
"require" : {
  "php" : "^7.0",
  "zendframework/zendframework" : "2.4.2",
  "doctrine/doctrine-orm-module" : "0.*",
  "zendframework/zend-developer-tools" : "1.0.0",
  "zf-commons/zfc-user" : "1.*",
  "zf-commons/zfc-user-doctrine-orm" : "1.0.1",
  "bjyoungblood/bjy-authorize" : "1.4.0",
  "evandotpro/edp-module-layouts" : "1.0",
  "gedmo/doctrine-extensions" : "2.4.*",
  "zendframework/zftool" : "dev-master",
  "alcaeus/mongo-php-adapter" : "1.0.5",
  "doctrine/doctrine-mongo-odm-module" : "0.10.0",
  "eluceo/ical": "0.7.0",
  "phpoffice/phpexcel": "1.8.1"
},

I moved from php5.5.9 on Ubuntu 14.04LTS to php 7 on Ubuntu 16.04.1LTS. The provide forces to retrieve the latest version. "Require" uses the one installed... Got it from here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM