简体   繁体   English

Composer:无法找到请求的包php

[英]Composer: The requested package php could not be found

Every time i try and run composer install , the dependencies fail due to the following error: 每次我尝试运行composer install ,由于以下错误,依赖项都会失败:

The requested package php could not be found

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. 我已经在LAMP堆栈上工作,但我现在正试图让它在LEMP堆栈上工作,使用php5-fpm并且它不顺利。

$ 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 编辑

I have other stuff in mine, but i tested the following composer.json on the same server, and its still doing it. 我有其他的东西,但我在同一台服务器上测试了以下composer.json ,它仍然在做它。

composer.json composer.json

{
   "require": {
        "php": "5.4.*"
    }
}

my composer version is 我的作曲家版本是

Composer version b7a9ea4187bce63f418bf7ba035b63dcb1e23ef6 2014-02-06 22:07:47

Am I missing something? 我错过了什么吗?

Well, that's easy: Composer is exactly doing what you tell it to do. 嗯,这很容易:Composer正在做你告诉它做的事情。

You are requesting any version of PHP 5.4. 您正在请求任何版本的PHP 5.4。 You explicitly do not allow any versions of 5.5. 您明确不允许5.5的任何版本。 So Composer correctly complains about having not the right version of PHP (yours is PHP 5.5, you request 5.4.*). 因此,Composer正确地抱怨没有正确版本的PHP(你的是PHP 5.5,你请求5.4。*)。

It is very unlikely that your code does not run with the newer version, so it's best to use this composer.json content: 您的代码不太可能不使用较新版本,因此最好使用此composer.json内容:

{
    "require": {
        "php": ">=5.4"
    }
}

Requesting a version greater than or equal 5.4 will also include 5.5 and above. 请求大于或等于5.4的版本还将包括5.5及更高版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM