Failed to update composer?

I have been using composer for about a month. And then one day the composer will show me this message:

A warning. This development is for a composer older than 30 days. it is recommended that you upgrade it by running "/ usr / local / bin / composer self-update" to get the latest version.

I installed the composer around the world according to the documentation.

which composer /usr/local/bin/composer 

Performing self-updating sudo composer gives me the following message:

/ usr / bin / env: php: No such file or directory

I checked / usr / bin / env with this command:

 whereis /usr/bin/env env: /usr/bin/env /usr/bin/X11/env /usr/share/man/man1/env.1.gz 

my php version:

 PHP 5.5.1 (cli) (built: Jul 26 2013 19:50:47) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans 

It seems that / usr / bin / env exists.

I am using ubuntu 12.04LTS .

Update

 strace sudo composer self-update 2>&1 | grep open open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 open("/lib/i386-linux-gnu/libutil.so.1", O_RDONLY|O_CLOEXEC) = 3 open("/lib/i386-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3 open("/usr/share/locale/en_PH/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en_PH/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/var/run/utmp", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 

Btw, I use xampp installed in / opt and php is in my PATH .

 echo $PATH /home/chanhxc/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/chanhxc/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lampp/bin:/home/chanhxc/pear/bin:/home/chanhxc/.composer/vendor/bin:/opt/lampp/bin 
+7
php composer-php
source share
4 answers

Error message:

/ usr / bin / env: php: No such file or directory

reports that php not found, i.e. php-cli not installed or the php command is not in your PATH environment variable.

So you need to install ( sudo apt-get install php5-cli ) or put it in PATH:

 vim ~/.bashrc PATH=$PATH:/path/to/php-cli/bin export PATH 

UPDATE

According to Composer with XAMPP for Linux, the symlinking php executable problem should solve your problem:

ln -s /opt/lampp/bin/php /usr/local/bin/php

+20
source share

this solution will work if you have xampp

 ln -s /opt/lampp/bin/php /usr/local/bin/php 
+2
source share

I ran into the same issue (on Red Hat Enterprise Linux Server). My solution was to switch to root, not sudo:

 sudo su /usr/local/bin/composer self-update 
+1
source share

This is the same solution in Centos https://stackoverflow.com/a/166268/

  # /usr/local/php/bin/php -v # /usr/local/php/bin/php /usr/local/bin/composer self-update 

Yours faithfully

0
source share

All Articles