Using drush7 and drush8 on debian

Using drush7 and drush8 on debian

As Drupal8 was released i had to find a way to use drush8 with Drupal8 and Drush7 for Drupal7 sites. Having drush8 installed globally i wanted to have a simple drush7 to be used when i want to configure or setup a drupal7 site. So this simple solution works like a charm:

1. make a drush7 directory within your home directory and jump into it
sudo mkdir drush7 && cd drush7
2. Install drush 7 via composer:
 sudo composer require drush/drush:7.*
3. make an alias for drush7
sudo vi ~/.bashrc
alias drush7="~/drush7/vendor/bin/drush"

4. Test if it works
drush7 status
5. Yes, the output looks like this
Drush script:  /home/username/drush7/vendor/drush/drush/drush.php
Drush version:  7.1.0

You could of course do this with all the drush versions available, so using different versions for each usecase can be accomplished very easily.



Using two different Drush Versions on Debian Squeeze

Using two different Drush Versions on Debian Squeeze

Sometimes an accident can result in something good i have learned today. What happened?


While setting up my new Debian Squeeze Server a few weeks ago and stopping it due to the lack of time i tried to finish the process today. Having Drush version 4.4 installed for user root at that time i simply forgot about that. As i was logged in as user1 with root rights this time i was seeing an error message appear while trying to execute drush for user1. So i simply installed drush 5.0-dev within his home directory and wondered why

drush status

still gave me that famous

bash: drush: command not found

error. Haven´t i seen

PHP configuration     :  /my/path/to/php.ini
 Drush version         :  5.0-dev

before, suggesting that drush is there and working? Yes i have, but in the meantime i have been switching to the root user to do some work there and back to user1. This makes my system seem to forget that drush exists. Doing a simple

source .bash_profile

gets drush back for the user i am using at that moment.

Being logged in as root i can use drush v4.4. and user1 uses v5.0-dev. Great, as i can simply switch the release and play around trying different things that might not work on one of the 2 versions.

too be continued...