When working with docker, a common thing is to use a specific docker image/container to run composer. And it can be a good thing to run composer through HHVM to increase performance.
Composer and DoctrineMongoDBBundle
But if you try to install DoctrineMongoDBBundle thanks to this kind of composer container (php + composer + hhvm), you will probably have this error:
This is because composer (by default) checks if you have the good extensions installed for your project. And the container used to run composer is not the container we use to run our project.
The two ways I know to avoid/fix this problem are:
- Adding the
--ignore-platform-reqsoption to the composer command.
- Installing the mongo php extension in the composer container.
But if you use composer with HHVM, the second solution will not work because HHVM won’t detect installed PHP extensions like with “normal” PHP.
So I advise you to use the first solution:
You need to install php5-mongo extension in your app container !
Of course the previous explanation is valid for any other PHP extensions, not only php5-mongo !