The "Questions that may already have your answer" do give various instructions on how to install Drush and/or Composer, but they don't address my question. I did come across this comment:

Q: drush - which folder for install on VPS / root server (newbie): A: "You can install Drush in the folder of your choice. Preferably outside www-directory."

My question: I'm not sure if this is applicable to Composer as well? And if it is applicable to Composer as well, why do people give specific folders into which Composer must be installed into?

The reason for my concern into which folder I install Composer is because I want to run it without problems (in any case with as little as possible).

I'm listing the different options:

  1. mdir bin, cd bin, install Composer in [~/bin] directory.

  2. Install in /home/username/bin

  3. Install in [~/bin] and move to /usr/local/bin

  4. Install in the /usr/local/bin folder That is a hidden folder, I can access it if I say "cd /usr/local/bin" in my terminal, but it doesn't show in the file manager of cpanel. How does that relate to /home/username/bin (or doesn't it)?

  5. Install in the public_html folder (home/username/public_html)

  6. One article says that Drupal is installed in the /var/www/drupal folder.

  7. Another articles says that Drupal is installed in domains/websitename.com/htdocs/www

It seems to me that the [~/bin] directory is the preferred one?

  • I think the answer is here (I never tried): stackoverflow.com/questions/20894518/… ~/bin/composer/composer.phar – Net Sep 27 '16 at 15:50
  • Thank you - I checked it out (even more installation options but it didn't answer my question). They also mentioned "mkdir bin", as well as creating a directory where you want to install composer, i.e. /home/your_username/composer. – Gerhard Sep 28 '16 at 11:00
  • I did come across another article (test.joshmountain.com/blog/…) where the writer replied to my answer as follows: "Make sure you use cd /bin not cd bin, this will take you to the root directory before looking for the bin folder. You want to install Composer here so that it can be used by all cPanel users. " I was not even aware that there actually is a /bin directory (because its hidden), but this seems to be the answer to my question – Gerhard Sep 28 '16 at 11:00
  • For what it's worth, ~ is just a shorthand for your home directory; so ~/bin and /home/you/bin are one and the same (assuming your OS has home directories in /home). – tripleee Feb 26 '19 at 5:18
  • Everything in /home is personal, whereas everything outside is system-wide. There may be situations where the web server hides parts of the directory tree from its clients for security reasons, in which case you might have to install binaries needed by the web server in oddball places like /var/www. – tripleee Feb 26 '19 at 5:21

TL;DR My recommendation would be /usr/local/bin

It doesn't really matter as long as the directory is in the PATH of all users, and as long as it is not one of the locations which the OS wants full control over (those would be primarily /usr/bin and /bin). For most situations, a reasonable location is /usr/local/bin because it should already be in the system's default PATH and it is intended precisely for this purpose -- local installations which are not part of the OS proper.

For Linux, you might want to refer to the LHS entry; this standard codifies usage inherited from the original Unix.

If it's convenient for you, installing in $HOME/bin and then moving to a system-wide location is fine. In fact, most make install etc facilities expect you to be doing something like this.


If you want to install Composer on a shared linux server, do it in the /bin directory if you want it to be used by all cPanel users.

The /bin directory is existing but hidden, just type "cd /bin" (with the slash!) on your command line to get to it.

  • No, this is incorrect for most OSes. – tripleee Oct 31 '16 at 6:03
  • Also, the directory is in no way hidden. – tripleee Feb 26 '19 at 5:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.