Ascherer
Ascherer

Reputation: 8093

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:

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.

$ 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

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

my composer version is

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

Am I missing something?

Upvotes: 6

Views: 9207

Answers (1)

Sven
Sven

Reputation: 70933

Well, that's easy: Composer is exactly doing what you tell it to do.

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.*).

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"
    }
}

Requesting a version greater than or equal 5.4 will also include 5.5 and above.

Upvotes: 13

Related Questions