0

I have installed Composer Globally as this docs shows and it works for root user on my server CentOS 6.6 but as a normal user lets said webvm user it doesn't saying that composer is not found (see below):

[webvm@webvm ~]$ sudo composer
[sudo] password for webvm:
sudo: composer: command not found

Do I need to setup something else in order to get composer working from a non root user? webvm is in sudoers file so I not know what I'm missing here, any advice?

ReynierPM
  • 710
  • 5
  • 14
  • 30
  • I'd like to point out that composer should **NOT** be run as root, and `sudo composer` should not be run in the normal course of development or deployment. The unprivileged application/webserver user should be using composer **WITHOUT** sudo. The only time I'd even consider `sudo composer` would be with the `self-update` command, never `install` or `update`. – whitehat101 Dec 30 '14 at 22:47

1 Answers1

1

One of two issues are likely reasons:

  • Either it's not in webvms $PATH
  • It's only executable for root. Check the permissions
Sven
  • 98,649
  • 14
  • 180
  • 226
  • This are the permissions for the file `-rwxr-xr-x 1 root root 1029339 Dec 1 20:01 /usr/local/bin/composer` how I can fix the issue? What I should do on my server in order to get composer working out of root user? – ReynierPM Dec 02 '14 at 11:50
  • See if `sudo /usr/local/bin/composer` works. If it does, you have to add `/usr/local/bin` to your `$PATH`. – Sven Dec 02 '14 at 11:52
  • That works, where I should add this to the `$PATH`? In `home/webvm/.bashrc` file? What line I should add? – ReynierPM Dec 02 '14 at 11:54
  • @ReynierPM: [SF] is a site for pro admins. You are expected to know such fundamentals or be able to learn them yourself. Google exists. And yes, `~/.bashrc` might be an option if you use `bash`. – Sven Dec 02 '14 at 11:56
  • I have run the command `echo "$PATH"` and I able to see the route where composer file is: `/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/webvm/bin` then why isn't executed? – ReynierPM Dec 02 '14 at 12:00
  • http://stackoverflow.com/questions/257616/sudo-changes-path-why – Sven Dec 02 '14 at 12:04