Composer无法识别php 5.6.4

时间:2016-11-08 03:52:51

标签: php composer-php wamp

我已将PHP 5.6.4添加到Wamp并且它正常工作,图标为绿色并且能够在localhost上查看我的网站。

作为我们项目的一部分,我需要让Composer使用我们的一个插件。当我尝试使用GitBash安装Composer时,我收到此错误。

composer install

  Problem 1
    - Installation request for illuminate/container v5.3.16 -> satisfiable by illuminate/container[v5.3.16].
    - illuminate/container v5.3.16 requires php >=5.6.4 -> your PHP version (5.5.12) does not satisfy that requirement.
  Problem 2
    - Installation request for illuminate/contracts v5.3.16 -> satisfiable by illuminate/contracts[v5.3.16].
    - illuminate/contracts v5.3.16 requires php >=5.6.4 -> your PHP version (5.5.12) does not satisfy that requirement.
  Problem 3
    - Installation request for illuminate/database v5.3.16 -> satisfiable by illuminate/database[v5.3.16].
    - illuminate/database v5.3.16 requires php >=5.6.4 -> your PHP version (5.5.12) does not satisfy that requirement.
  Problem 4
    - Installation request for illuminate/support v5.3.16 -> satisfiable by illuminate/support[v5.3.16].
    - illuminate/support v5.3.16 requires php >=5.6.4 -> your PHP version (5.5.12) does not satisfy that requirement.
  Problem 5
    - illuminate/database v5.3.16 requires php >=5.6.4 -> your PHP version (5.5.12) does not satisfy that requirement.
    - devonblzx/wp-eloquent 5.3.x-dev requires illuminate/database 5.3.* -> satisfiable by illuminate/database[v5.3.16].
    - Installation request for devonblzx/wp-eloquent 5.3.x-dev -> satisfiable by devonblzx/wp-eloquent[5.3.x-dev].

问题5表明我不满足所需的PHP版本。我需要什么才能让Composer找到我需要的版本。

这是我的composer.json

{
    "name": "tours",
    "description": "Tours Package",
    "license": "Closed Source",
    "require": {
        "tourcms/tourcms-php": "3.0.*",
        "devonblzx/wp-eloquent": "5.3.x-dev"
    },
    "require-dev": {
        "psy/psysh": "0.7.*"
    },
    "suggest": {
        "tightenco/collect": "If Illuminate Support is not included, this package is required for collection support in tourcms_base"
    },
    "autoload": {
        "psr-4": {
            "": "tourcms_base/src/",
            "Discover\\": "",
            "GMaps\\": "gmaps/"
        }
    }
}

1 个答案:

答案 0 :(得分:3)

问题是composer使用在编写器安装期间指定的php二进制文件,而不是WAMP。几种解决方案:

在git bash

中覆盖composer(或php)的别名

将此添加到您的~/.bashrc或{gid bash中的~/.bash_profile

alias composer='path/to/php/binary composer.phar '

使git bash使用指定的PHP版本

将此添加到您的~/.bashrc或{gid bash中的~/.bash_profile

# Use WAMP version of PHP
PHP_VERSION=`ls /path/to/wamp/bin/php/ | sort -n | tail -1`
export PATH=/path/to/wamp/bin/php/${PHP_VERSION}/bin:$PATH

将WAMP的php路径添加到Windows环境变量

将PHP二进制文件的路径添加到PATH变量。 E.g:

;C:\wamp\bin\php\php5.6.4

有关详细信息,请参阅thisthis个问题。