permission denied for composer in /usr/local/bin/

2019-02-16 13:15发布

I followed the documentation on https://getcomposer.org/doc/00-intro.md#globally to install composer globally on arch linux. When I do composer self-update, I get this message:

  [ErrorException]                                                                                    
  rename(/home/hannes/.composer/cache/composer-temp.phar,/usr/local/bin/composer): Permission denied 

The permissions in /usr/local/bin/ (I changed them to 777, but it did not help):

-rwxrwxrwx  1 hannes users 1104202 30. Mai 18:07 composer

In my home directory I did this:

sudo chmod -R 777 .composer/

In /etc/php/php.ini, the open_basedir looks so:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/usr/local/bin/

I also tried sudo composer self-update but it did not work as well and is possibly not the right way. (?). What else could I try to make this work?

8条回答
ら.Afraid
2楼-- · 2019-02-16 13:56

Even after moving the file via sudo mv composer.phar /usr/local/bin/composer I was getting a permission error when trying to run the composer command. sudo chmod 755 /usr/local/bin/composer fixed things for me.

查看更多
姐就是有狂的资本
3楼-- · 2019-02-16 13:59

this might be the case if you have downloaded composer.phar directly ,

but not by running php composer-setup.php

make composer.phar executable with following command before moving it to /usr/local/bin/composer or after moving

sudo chmod 755 composer.phar

composer-setup.php will make this change for us by default

查看更多
登录 后发表回答