Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 635
Ascherer Avatar asked Feb 07 '14 04:02

Ascherer


People also ask

Why is composer not installing?

Make sure you have no problems with your setup by running the installer's checks via curl -sS https://getcomposer.org/installer | php -- --check . Try clearing Composer's cache by running composer clear-cache . Ensure you're installing vendors straight from your composer.

How do I know if my composer is working?

6. Test Composer. Open up Command Prompt and type composer -V (that's uppercase V). If all was installed correctly, you should see a version number.


1 Answers

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.

like image 138
Sven Avatar answered Sep 20 '22 17:09

Sven