I'm running a Drupal hosting server, where the client's installation is below the directory


The full path to any of the client's websites is

/var/www/<client-id>/htdocs/<drupal root>/web

The client is provided with a login to his client-id directory, where .bashrc lives, which sets the PATH to the vendor/bin directory -- but you can provide only one path per client, when a different PATH per drupal root would be needed.

How can I set up drush or bash to use the proper drupal root comfortably?

I know I could provide a script at drupal root, but if the client jumps between various drupal root installations, it might become cumbersome to also run the script before calling drush in the other drupal root.

Before 12, things where focused on drupal root and everything worked without any issues, as long as the user was in <drupal root>/web

Upgrade after I found out what bugged me in the first place:

With drush < 12, I could issue a drush command in any directory at or below 'web-root'. With a path ./vendor/bin, I will constrain myself to use drush from web-root only.

Is there a better way to solve this properly in a multi-site client installation as described above?

  • 1
    The drush-launcher archived project's README recommends to set an relative path in the front of your $PATH: "Add ./vendor/bin to the front of your $PATH."
    – leymannx
    Commented Dec 20, 2023 at 9:57
  • 1
    In front, it can be a problem if you use core-dev, the local composer has priority over the global one. Better put it at the end: export PATH="$PATH:./vendor/bin" and remove any drush binaries still in global directories. To be sure check which drush and which composer from <drupal root> that drush is local and composer is global. See drupal.stackexchange.com/questions/317478/…
    – 4uk4
    Commented Dec 20, 2023 at 10:47

1 Answer 1


AFAIK Drush is built to work from ./drupal_root, not from ./drupal_root/web.

I'm using a similar setup to your's (not nested as deep though), my current directory relative path variable using the leading dot ./vendor/bin/ still works inside the respective drupal project roots:

My .bashrc looks like PATH="/some/other/stuff:./vendor/bin:$PATH"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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