Composer is installed, but get / usr / bin / env: php: There is no such file or directory

On CentOS 7, I installed PHP 7.1.

Then I installed the composer using

cd /tmp curl -sS https://getcomposer.org/installer | php71 --> used php71 instead of php, php didn't work mv composer.phar /usr/local/bin/composer 

Then, using composer , I get:

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

When using sudo composer I get:

 sudo: composer: command not found 
+5
source share
3 answers

As @alexhowansky suggested, I ran the following command:

 sudo ln -s /usr/bin/php71 /usr/bin/php 

Now the composer's team is working. Thanks

+9
source

This worked for me [Centos 7 with php 7.1]:
yum install php71w-cli

+2
source

You need to add /usr/local/bin to your PATH variable. The easiest way is to drop it into your profile or bash_profile file located at:

  • ~ / .profile
  • ~ / .bash_profile

Add the following to one of these files:

 export PATH="$PATH:/usr/local/bin/" 

See https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path for details

If you are logged in when you add it, you can force Linux to read the file again and update the path (after making the changes) using source from the bash prompt:

 source ~/.bash_profile 

Regarding php7 vs. issue php , as Alex suggested, you can make a symbolic link, so it works like an alias.

+1
source

All Articles