0

I'm following the steps in get composer.org and I want to install composer globally and give me this error.

   mv: cannot move ‘composer.phar’ to ‘/usr/local/bin/composer’: Permission denied

So what I'm missing here?

karel
  • 114,770

3 Answers3

4

You need to use

sudo mv composer.phar /usr/local/bin/composer

to move the file to the specified location(/usr/local/bin/composer). You will be prompted to enter your password after you enter this command. (See the note after the command).

sudo is used to execute privileged commands and requires the user who is executing this command present in the sudoers list.

If you encounter an error such as this:

user is not in the sudoers list. This incident will be reported

You will need to ask your administrator to run this command for you as you are not privileged enough to run this command.

jobin
  • 27,708
0

try to logout on your server and sign in again then try to install again

  1. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

  2. php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

  3. php composer-setup.php

  4. php -r "unlink('composer-setup.php');"

0

if you run it on external server than don't move your composer.phar instead use below command

php composer.phar update