问题描述
每次尝试运行 composer install
时,依赖项都会由于以下错误而失败:
Every time i try and run composer install
, the dependencies fail due to the following error:
The requested package php could not be found
我知道了在LAMP堆栈上工作,但是我现在尝试在php5-fpm上使其在LEMP堆栈上工作,并且运行不正常。
I've got this working on a LAMP stack, but I'm trying to get it working on a LEMP stack now, with php5-fpm and its not going well.
$ php -v
PHP 5.5.8-3+sury.org~precise+2 (cli) (built: Jan 29 2014 13:23:55)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
编辑
EDIT
我还有其他东西,但是我在同一位置测试了以下 composer.json
I have other stuff in mine, but i tested the following composer.json
on the same server, and its still doing it.
composer.json
{
"require": {
"php": "5.4.*"
}
}
我的作曲家版本是
Composer version b7a9ea4187bce63f418bf7ba035b63dcb1e23ef6 2014-02-06 22:07:47
我错过了什么吗?
推荐答案
好吧,这很简单:Composer确实在做什么
Well, that's easy: Composer is exactly doing what you tell it to do.
您正在请求任何版本的PHP 5.4。您明确不允许使用任何5.5版本。因此Composer会正确地抱怨没有正确的PHP版本(您的PHP是PHP 5.5,您要求5.4。*。)。
You are requesting any version of PHP 5.4. You explicitly do not allow any versions of 5.5. So Composer correctly complains about having not the right version of PHP (yours is PHP 5.5, you request 5.4.*).
代码不太可能无法运行使用较新的版本,因此最好使用以下 composer.json
内容:
It is very unlikely that your code does not run with the newer version, so it's best to use this composer.json
content:
{
"require": {
"php": ">=5.4"
}
}
请求大于或等于5.4的版本还将包括5.5及更高版本。
Requesting a version greater than or equal 5.4 will also include 5.5 and above.
这篇关于作曲者:找不到要求的套件php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!