Composer installed, but get /usr/bin/env: php: No such file or directory

前端 未结 4 1276
野趣味
野趣味 2021-01-31 18:54

On CentOS 7, I installed PHP 7.1.

Then I installed composer with:

cd /tmp
curl -sS https://getcomposer.org/installer | php71     --> used php71 inste         


        
4条回答
  •  清歌不尽
    2021-01-31 19:57

    You need to add /usr/local/bin to your PATH variable. The easiest way is to throw it in your profile or bash_profile located at either:

    • ~/.profile
    • ~/.bash_profile

    You would add the following to one of those files:

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

    For more details, see: https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path

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

    source ~/.bash_profile
    

    As for the php7 vs. php issue, as Alex suggested, you can make a symlink so it works kinda like an alias.

提交回复
热议问题