Laravel没有安装依赖项不正确的php版本

时间:2016-12-30 22:04:02

标签: php laravel web frameworks xampp

我无法安装所有laravel依赖项,因为php版本但我使用xampp(PHP 7.0.13)使用echo phpversion();来确定我的php版本但是这个laravel一直告诉我我正在使用php版本5.4.24当我安装一个新的laravel目录时。

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\User>cd C:\xampp

C:\xampp>laravel new htdocs
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php >=5.6.4 but your PHP version (5.4.24) does not satisfy that requirement.
  Problem 2
    - Installation request for classpreloader/classpreloader 3.1.0 -> satisfiable by classpreloader/classpreloader[3.1.0].
    - classpreloader/classpreloader 3.1.0 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 3
    - Installation request for laravel/framework v5.3.28 -> satisfiable by laravel/framework[v5.3.28].
    - laravel/framework v5.3.28 requires php >=5.6.4 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 4
    - Installation request for league/flysystem 1.0.32 -> satisfiable by league/flysystem[1.0.32].
    - league/flysystem 1.0.32 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 5
    - Installation request for nikic/php-parser v3.0.2 -> satisfiable by nikic/php-parser[v3.0.2].
    - nikic/php-parser v3.0.2 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 6
    - Installation request for symfony/console v3.1.8 -> satisfiable by symfony/console[v3.1.8].
    - symfony/console v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 7
    - Installation request for symfony/debug v3.1.8 -> satisfiable by symfony/debug[v3.1.8].
    - symfony/debug v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 8
    - Installation request for symfony/event-dispatcher v3.2.1 -> satisfiable by symfony/event-dispatcher[v3.2.1].
    - symfony/event-dispatcher v3.2.1 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 9
    - Installation request for symfony/finder v3.1.8 -> satisfiable by symfony/finder[v3.1.8].
    - symfony/finder v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 10
    - Installation request for symfony/http-foundation v3.1.8 -> satisfiable by symfony/http-foundation[v3.1.8].
    - symfony/http-foundation v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 11
    - Installation request for symfony/http-kernel v3.1.8 -> satisfiable by symfony/http-kernel[v3.1.8].
    - symfony/http-kernel v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 12
    - Installation request for symfony/process v3.1.8 -> satisfiable by symfony/process[v3.1.8].
    - symfony/process v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 13
    - Installation request for symfony/routing v3.1.8 -> satisfiable by symfony/routing[v3.1.8].
    - symfony/routing v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 14
    - Installation request for symfony/translation v3.1.8 -> satisfiable by symfony/translation[v3.1.8].
    - symfony/translation v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 15
    - Installation request for symfony/var-dumper v3.1.8 -> satisfiable by symfony/var-dumper[v3.1.8].
    - symfony/var-dumper v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 16
    - Installation request for phpdocumentor/reflection-common 1.0 -> satisfiable by phpdocumentor/reflection-common[1.0].
    - phpdocumentor/reflection-common 1.0 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 17
    - Installation request for phpdocumentor/reflection-docblock 3.1.1 -> satisfiable by phpdocumentor/reflection-docblock[3.1.1].
    - phpdocumentor/reflection-docblock 3.1.1 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 18
    - Installation request for phpdocumentor/type-resolver 0.2.1 -> satisfiable by phpdocumentor/type-resolver[0.2.1].
    - phpdocumentor/type-resolver 0.2.1 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 19
    - Installation request for phpunit/php-code-coverage 4.0.4 -> satisfiable by phpunit/php-code-coverage[4.0.4].
    - phpunit/php-code-coverage 4.0.4 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 20
    - Installation request for phpunit/phpunit 5.7.5 -> satisfiable by phpunit/phpunit[5.7.5].
    - phpunit/phpunit 5.7.5 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 21
    - Installation request for phpunit/phpunit-mock-objects 3.4.3 -> satisfiable by phpunit/phpunit-mock-objects[3.4.3].
    - phpunit/phpunit-mock-objects 3.4.3 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 22
    - Installation request for sebastian/code-unit-reverse-lookup 1.0.0 -> satisfiable by sebastian/code-unit-reverse-lookup[1.0.0].
    - sebastian/code-unit-reverse-lookup 1.0.0 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 23
    - Installation request for sebastian/environment 2.0.0 -> satisfiable by sebastian/environment[2.0.0].
    - sebastian/environment 2.0.0 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 24
    - Installation request for sebastian/object-enumerator 2.0.0 -> satisfiable by sebastian/object-enumerator[2.0.0].
    - sebastian/object-enumerator 2.0.0 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 25
    - Installation request for sebastian/resource-operations 1.0.0 -> satisfiable by sebastian/resource-operations[1.0.0].
    - sebastian/resource-operations 1.0.0 requires php >=5.6.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 26
    - Installation request for sebastian/version 2.0.1 -> satisfiable by sebastian/version[2.0.1].
    - sebastian/version 2.0.1 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 27
    - Installation request for symfony/css-selector v3.1.8 -> satisfiable by symfony/css-selector[v3.1.8].
    - symfony/css-selector v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 28
    - Installation request for symfony/dom-crawler v3.1.8 -> satisfiable by symfony/dom-crawler[v3.1.8].
    - symfony/dom-crawler v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 29
    - Installation request for symfony/yaml v3.2.1 -> satisfiable by symfony/yaml[v3.2.1].
    - symfony/yaml v3.2.1 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 30
    - nikic/php-parser v3.0.2 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
    - psy/psysh v0.8.0 requires nikic/php-parser ~1.3|~2.0|~3.0 -> satisfiable by nikic/php-parser[v3.0.2].
    - Installation request for psy/psysh v0.8.0 -> satisfiable by psy/psysh[v0.8.0].

Application ready! Build something amazing.

C:\xampp>

3 个答案:

答案 0 :(得分:2)

已经解决了。看来我的系统正在使用IIS Express的另一个php版本,它使用旧版本的php。我只是将环境变量更改为指向我的xampp php,其中包含最新的php版本

答案 1 :(得分:1)

我刚才有这个问题,我通过将操作系统中的Path环境变量更改为指向包含最新php版本的wamp php文件夹来修复它。 为了做到这一点(我也必须研究这个) - 我去了这个链接并按照说明进行了操作:https://www.java.com/en/download/help/path.xml

旧的Path变量看起来像这样:C:\ wamp64 \ bin \ php \ php5.6.25我将其更改为C:\ wamp64 \ bin \ php \ php7.0.10 保存所有内容,关闭所有内容,重新启动我的电脑然后它没有任何问题。 希望这为某人节省了一些研究时间。

答案 2 :(得分:1)

你需要做两件事之一。

解决方案1 ​​ - 您需要更新PHP版本。如果您的版本不正确,Laravel将无法正常运行。

解决方案2 - 也许您拥有正确的PHP版本,但作曲家出于某种原因无法看到它。轻松修复,您只需使用--ignore-platform-reqs命令即可​​。这将允许您使用composer安装东西,无论PHP版本如何。