drupalcomposer-phpcircleci

composer install -n --ignore-platform-reqs not ignoring PHP extension


we have circle build that runs composer install -n --ignore-platform-reqs --no-dev but this is not ignoring the platform requirements anymore.

This is what i see in the circle log. The --ignore-platform-reqs is clearly not working. Any ideas why please?

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for drupal/core 8.6.13 -> satisfiable by drupal/core[8.6.13].
    - drupal/core 8.6.13 requires ext-pdo * -> the requested PHP extension pdo is missing from your system.
  Problem 2
    - typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - typo3/phar-stream-wrapper v2.1.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - Installation request for typo3/phar-stream-wrapper v2.1.0 -> satisfiable by typo3/phar-stream-wrapper[v2.1.0].

Solution

  • Instead of using --ignore-platform-reqs or provide hack it is better to mimic your environment using platform setting - it gives you more control about platform requirements and it is more intuitive than provide (your package does not really provide ext-fileinfo):

    "config": {
        "platform": {
            "php": "7.2.14",
            "ext-fileinfo": "1.0.5",
            "ext-pdo": "7.2.14",
            "ext-session": "7.2.14",
            "ext-iconv": "7.2.14",
            "ext-zip": "1.15.4"
        }
    },
    

    Actual versions of extensions you may find by calling this command on production environment (although you could probably put anything for extensions version - it is quite uncommon to use anything except * as a constraint for PHP extensions):

    composer show -p