Search code examples
phpmongodbcloud-foundryswisscomdevcomposer-php

How to update MongoDB version in Swisscom Application Cloud?


I’m using the Swisscom Application Cloud, which is a Platform-as-a-Service (PaaS) using Cloud Foundry, to deploy a PHP application and I need MongoDB as a dependency to make queries.

I’m using the composer.json to specify the mongodb/mongodb dependency but on “cf push” I have the following error “mongodb/mongodb 1.3.0 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb has the wrong version (1.2.9) installed.”.

How should I declare my dependency or update it?

I did not specify a version with composer (“composer require mongodb/mongodb”) but when I’ve tried with the version 1.2.0 (“composer require mongodb/mongodb:1.2.0”), I got the same error but with “mongodb/mongodb 1.2.0 requires ext-mongodb ^1.3.0 -> the requested PHP extension mongodb has the wrong version (1.2.9) installed.”

Any help would be appreciated. Thanks.

enter image description here


Solution

  • I can't see from the picture, but it sounds like you're using an older version of the PHP buildpack. The PHP buildpack supplies the version of PHP that you're using and a set of extensions. The extension versions are fix to the time that the PHP buildpack was compiled. This may seem bad, but there are new versions of the PHP buildpack every time there's a new version of PHP, which happens on a fairly frequent and regular cadence.

    I took a look at the most recent, as of me writing this, version of the PHP buildpack and it contains mongodb extension version 1.4.1.

    If you want to use that version of the PHP buildpack you can cf push with the argument -b https://github.com/cloudfoundry/php-buildpack#v4.3.51.

    Hope that helps!