Symfony2, composer, 你的 PHP 版本 (5.6.18) 被 "config.platform.php" 版本 (5.3.9) 覆盖不满足要求

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35538071/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:29:47  来源:igfitidea点击:

Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement

phpsymfonydoctrine-ormcomposer-php

提问by Gintare Statkute

I am trying to install doctrine to my project. I am getting the error about the wrong PHP version. What can be done to remove the real reason for this error? The way to overcome it is to use the option "--ignore-platform-reqs" as described https://getcomposer.org/doc/03-cli.md#require.

我正在尝试将学说安装到我的项目中。我收到有关错误 PHP 版本的错误消息。可以做些什么来消除此错误的真正原因?克服它的方法是使用选项“ --ignore-platform-reqs”,如https://getcomposer.org/doc/03-cli.md#require所述。

PHP version: PHP 5.6.18

PHP 版本:PHP 5.6.18

PHP 5.6.18  (cli) (built: Feb  3 2016 17:20:21)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

The error: c..>composer require doctrine/data-fixtures

错误:c..>composer 需要学说/数据装置

Using version ^1.1 for doctrine/data-fixtures
./composer.json has been updated
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
    - doctrine/migrations v1.3.0 requires php ^5.5|^7.0 -> your PHP version (5.6
.18) overriden by "config.platform.php" version (5.3.9) does not satisfy that re
quirement.
    - doctrine/migrations v1.2.2 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
    - doctrine/migrations v1.2.1 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
    - doctrine/migrations v1.2.0 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
    - doctrine/migrations v1.1.0 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
    - doctrine/migrations v1.0.0 requires php >=5.4.0 -> your PHP version (5.6.1
8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ
irement.
    - Installation request for doctrine/migrations ~1.0 -> satisfiable by doctri
ne/migrations[v1.0.0, v1.1.0, v1.2.0, v1.2.1, v1.2.2, v1.3.0].


Installation failed, reverting ./composer.json to its original content.

The content of composer.json

composer.json 的内容

"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.8.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "doctrine/data-fixtures" : "~1.1",
    "doctrine/doctrine-fixtures-bundle": "dev-master",

回答by Valentas

Somewhere in your composer.jsonyou have

在你的某个地方composer.json你有

"config": {
   "preferred-install": "dist",
   "platform": {
       "php": "5.3.9"
   }
}

That block overrides your current PHP version as described in composer doc.

该块将覆盖您当前的 PHP 版本,如composer doc 中所述

回答by chalasr

In your composer.json, remove the following lines :

在您的 composer.json 中,删除以下几行:

// ...
"config": {
    "platform": {
        "php": "5.3.9"
    }
},
// ...

See platform config in composer.

请参阅composer 中的平台配置

回答by Muhammed M.

I use doctrine migrations with Symfony 2.7

我在 Symfony 2.7 中使用了学说迁移

In my composer.json I have, I noticed you don't, you could try adding it

在我的 composer.json 我有,我注意到你没有,你可以尝试添加它

"doctrine/doctrine-migrations-bundle": "^1.0"

I manually installed migrations following Symfony2 docs, you can read it here.

我按照 Symfony2 文档手动安装了迁移,您可以在此处阅读。

This is my whole 2.7 Symfony composer:

这是我的整个 2.7 Symfony 作曲家:

"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "~2.2,>=2.2.3,<2.5",
    "doctrine/dbal": "<2.5",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "1.3.*@dev",
    "ircmaxell/password-compat": "^1.0",

    "sonata-project/block-bundle": "2.3.*@dev",
    "sonata-project/easy-extends-bundle": "^2.1",
    "sonata-project/datagrid-bundle": "~2.2@dev",
    "sonata-project/admin-bundle": "~2.3@dev",
    "sonata-project/doctrine-orm-admin-bundle": "~2.3@dev",
    "sonata-project/user-bundle": "~2.3@dev",
    "doctrine/doctrine-migrations-bundle": "^1.0"

},