即使安装了正确的 php 版本,为什么在 Composer 安装期间为过时的 php 版本出现版本不匹配? [英] Why do I get a version mismatch during composer install for an outdated php version even though correct php version is installed?

查看:65
本文介绍了即使安装了正确的 php 版本,为什么在 Composer 安装期间为过时的 php 版本出现版本不匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于非常基础的 composer.json:

{
  "name": "kopernikus/fizzbuzz",
  "description": "FizzBuzz!",
  "type": "project",
  "require": {
    "php": "^7.0"
  },
  "require-dev": {
    "phpunit/phpunit": "^6.5"
  },
  "license": "MIT",
  "authors": [
    {
      "name": "Philipp Kretzschmar",
      "email": "philipp.kretzschmar@gmail.com"
    }
  ]
}

如果我跑:

$ composer install

我明白了:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php ^7.0 but your PHP version (5.5) does not satisfy that requirement.
  Problem 2
    - phpunit/phpunit 5.7.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.26 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.25 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.24 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.23 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.22 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.21 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.20 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.19 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.18 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.17 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.16 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.14 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.13 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.12 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.11 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.10 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.7.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.6.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.5.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.5.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.5.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - phpunit/phpunit 5.5.4 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.5.3 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.5.2 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.5.1 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.5.0 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.8 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.7 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.6 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.5 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.4 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.3 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.2 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.1 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.4.0 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.3.5 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.3.4 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.3.3 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.3.2 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.3.1 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.3.0 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.9 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.8 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.7 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.6 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.5 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.4 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.3 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.2 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.12 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.11 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.10 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.1 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.2.0 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.7 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.6 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.5 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.4 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.3 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.2 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.1 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.1.0 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.9 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.8 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.7 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.6 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.5 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.4 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.3 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.2 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.10 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.1 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.0.0 requires php >=5.6 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - phpunit/phpunit 5.5.4 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.
    - Installation request for phpunit/phpunit ^5 -> satisfiable by phpunit/phpunit[5.0.0, 5.0.1, 5.0.10, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7, 5.0.8, 5.0.9, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.1.4, 5.1.5, 5.1.6, 5.1.7, 5.2.0, 5.2.1, 5.2.10, 5.2.11, 5.2.12, 5.2.2, 5.2.3, 5.2.4, 5.2.5, 5.2.6, 5.2.7, 5.2.8, 5.2.9, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.4, 5.3.5, 5.4.0, 5.4.1, 5.4.2, 5.4.3, 5.4.4, 5.4.5, 5.4.6, 5.4.7, 5.4.8, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.5, 5.5.6, 5.5.7, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.6.4, 5.6.5, 5.6.6, 5.6.7, 5.6.8, 5.7.0, 5.7.1, 5.7.10, 5.7.11, 5.7.12, 5.7.13, 5.7.14, 5.7.15, 5.7.16, 5.7.17, 5.7.18, 5.7.19, 5.7.2, 5.7.20, 5.7.21, 5.7.22, 5.7.23, 5.7.24, 5.7.25, 5.7.26, 5.7.3, 5.7.4, 5.7.5, 5.7.6, 5.7.7, 5.7.8, 5.7.9].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/15-xml.ini
    - /etc/php/7.0/cli/conf.d/20-apcu.ini
    - /etc/php/7.0/cli/conf.d/20-apcu_bc.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-curl.ini
    - /etc/php/7.0/cli/conf.d/20-dom.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-intl.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-mongodb.ini
    - /etc/php/7.0/cli/conf.d/20-mysqli.ini
    - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-simplexml.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.0/cli/conf.d/20-wddx.ini
    - /etc/php/7.0/cli/conf.d/20-xmlreader.ini
    - /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
    - /etc/php/7.0/cli/conf.d/20-xsl.ini

我很困惑,因为:

php -v
PHP 7.0.26-2+ubuntu16.04.1+deb.sury.org+2 (cli) (built: Dec  7 2017 20:09:40) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.26-2+ubuntu16.04.1+deb.sury.org+2, Copyright (c) 1999-2017, by Zend Technologies

我还检查了作曲家脚本,它已经定义:

I also checked the composer script, it has defined:

$ which composer
/usr/local/bin/composer

$ head -n 1 /usr/local/bin/composer
#!/usr/bin/env php

$ /usr/bin/env php
PHP 7.0.26-2+ubuntu16.04.1+deb.sury.org+2 (cli) (built: Dec  7 2017 20:09:40) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.26-2+ubuntu16.04.1+deb.sury.org+2, Copyright (c) 1999-2017, by Zend Technologies

即使 diagnose 也不会引起警报:

Even diagnose gives no cause to alarm:

$ composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.6.1
PHP version: 7.0.26-2+ubuntu16.04.1+deb.sury.org+2
PHP binary path: /usr/bin/php7.0

为什么我只安装了 php@7,composer 却认为我在运行 php@5.5?

Why does composer think I am running php@5.5 even though I only have php@7 installed?

推荐答案

检查你的 Composer 配置,你已经覆盖了你的 平台 设置.

Check your composer config, you have overwritten your platform settings.

这在日志行中变得明显:

This becomes apparent by the log line:

   - phpunit/phpunit 5.5.4 requires php ^5.6 || ^7.0 -> your PHP version (7.0.26-2+ubuntu16.04.1+deb.sury.org+2) overridden by "config.platform.php" version (5.5) does not satisfy that requirement.

重要的一点:

your PHP version (7...) overridden by "config.platform.php" version (5.5)

此外,您可以通过以下方式查看它是否设置:

Also, you can see if it is set via:

$ composer config platform.php
5.5

它对于构建机器很有用,这样 composer 可以在运行不同 php 版本的机器上安装依赖项.但它不应该一直存在于我的开发机器上.

It's useful for build machines so that composer can install dependencies on machines running different php versions. Yet it should not have persisted on my development machine.

我过去将平台设置为 5.5 仍然能够 composer install php7 下的 php5 项目,即使 composer install --ignore-platform-reqs 会足够了,或者也可以在项目级别设置平台配置.我在全局配置中有它:

I set the platform to 5.5 in the past to still be able to composer install a php5 project under php7 even though composer install --ignore-platform-reqs would suffice or one could set the platform config on a project level as well. I had it in the global config though:

$ jq . ~/.composer/config.json 
{
  "config": {
    "platform": {
      "php": "5.5"
    }
  }
}

在较新的作曲家版本上,配置湾是:

On newer composer version the config bay be part of the:

jq . ~/.config/composer/composer.json 
{
  "require": {
    "hirak/prestissimo": "^0.3.7"
  },
  "config": {
    "platform": {
      "php": "5.5"
    }
  }
}

我也可能存在于您项目的 composer.json 中.

I might also exist within your project's composer.json.

我必须删除平台配置并且还必须composer update项目的composer.lock.仅删除配置是不够的.

I had to remove the platform config and had to composer update the project's composer.lock as well. Only removing the config did not suffice.

这篇关于即使安装了正确的 php 版本,为什么在 Composer 安装期间为过时的 php 版本出现版本不匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆